Sharing Google oAuth Tokens between Android, iOS and Web apps

1.2k views Asked by At

We're building an application which accesses files in Google Drive. Our application has a web UI, an Android App and an iOS app. We use oAuth2 to let the user authorize our app to access their Google Drive account. We use the Google Drive Java SDK in the web application and the Android/iOS SDK of Google Drive for mobile. We're unable to use the oAuth tokens returned by the Android SDK in iOS and vice versa. We also can't use the token received by the Java SDK(by our web server) in the Android app. Because of this, we have had to create separate oAuth clients for each platform(web, Android, iOS) and the user needs to authorize once on each platform, which is not very user-friendly. Is there a better way to use the same oAuth token across clients? Am I missing something very basic here?

1

There are 1 answers

0
nvnagr On

You'll need to get a token on iOS and Android for the server.

See this doc for iOS See this doc for Android

On each of the app, you'll ask a user to sign in first. Then check on the server if there is already a token or not. If not then ask for that access and store the token on the server.