Integrate oauth2 with native (iOS/Android) mobile application

前端 未结 2 1137
死守一世寂寞
死守一世寂寞 2021-01-13 05:33

I need to integrate OAuth2 in a iOS and Android native application. I have been researching on OAuth2 and mobile applications and found this documentation - Google APIs - Us

2条回答
  •  走了就别回头了
    2021-01-13 06:26

    From my experience, I've found that there are very little libraries that actually support retrieving the authorization code in a clean way.

    On most mobile platform you can "listen" to redirection URLS (being http or some custom scheme)

    For example on Android one can easily create an activity to retrieve an access token (based on an authorization code it receives via the redirection URL.

        >
            
                
                
                
                
            
           
    

    In this case

    http://localhost
    

    On mobile platforms like Android this seems like the logical thing to do.

    The same can be done on iOS, but the Google OAuth library for iOS uses the page title approach if I remember correctly.

    Technically there is no difference between the 2 flows. The only difference is the syntax of the redirection URL, resulting in a different location of the authorization code.

    From a security point of view, the authorization code alone is worthless without the OAuth2 client secret.

    Having the user enter an authorization code is something that I'm not used to seeing in Oauth2 flows but it is possible. If doubt that it will add anything security-wise. IMHO it will only frustrate the user.

    That doesn't mean that there are different ways of retrieving and processing an authorization code (Automatic capturing of the code through redirects with localhost or custom URI schemes, or manual delivery)

提交回复
热议问题