react-native-oauth: Scopes not working for Google on Android

Hi there,

I’m trying to pass scope to Google as follows:

        manager.authorize('google', {scopes: 'profile email'})
            .then(resp => this.cleanLoginData('google',resp.response))
            .catch(err => console.log('There was an error'))

However, that doesn’t seem to provide the email when I try to call manager.makeRequest(‘google’,googleUrl) to https://www.googleapis.com/oauth2/v1/userinfo?alt=json.

The solution was to go into android/src/main/java/io/fullstack/oauth/OAuthManagerProviders.java and change line 101 to String scope = “profile email”;

Is this a known issue, or am I doing something wrong? I notice that a lot of the language in the java files refers to “scope” rather than “scopes” (with the “s”), as passed in the above authorize code snippet. Could this be the issue?

Thanks! Jason

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (22 by maintainers)

Commits related to this issue

Most upvoted comments

Try including scope in the config constant along with the client_id and client_secret instead of in the options hash like so:

    const config =  {
      github: {
        client_id: Platform.OS === 'ios' ? Config.GITHUB_CLIENT_ID : Config.GITHUB_CLIENT_ID_ANDROID,
        client_secret: Platform.OS === 'ios' ? Config.GITHUB_CLIENT_SECRET : Config.GITHUB_CLIENT_SECRET_ANDROID,
        scope: 'user'
      }
    }