react-native-oauth icon indicating copy to clipboard operation
react-native-oauth copied to clipboard

Different response objects for iOS and Android

Open SekibOmazic opened this issue 8 years ago • 2 comments

Hi,

i've made a simple App that reads user information from twitter once use logs in. So following call:

manager.authorize('twitter', {scopes: 'email'})
       .then(resp => { console.log('OAuth ->', resp) })
       .catch(err => console.log(err))

gets following responses:

Android:

{
  authorized: true,
  provider:"twitter",
  response: {
    credentials: {
      accessToken: "243289845-8ZpTDfcGALlXujZhavI ...",
      consumerKey: "PI21XdrLJoymr ...",
      type: "Bearer"
    },
    uuid: "243xxxxxx"
  },
  status: "OK"
}

iOS:

{
  provider:"twitter",
  response: {
    authorized: true,
    credentials: {
      access_token: "243289845-8ZpTDfcGALl ...",
      access_token_secret: "VEpo0LrLqkPnl7Y ...",
      type: "Bearer"
    },
    identifier: "7AC33593-9AB2-4CDA-B769-XXXXXXXX"
    uuid: "7AC33593-9AB2-4CDA-B769-XXXXXXXX"
  },
  status: "OK"
}

Notice the different UUIDs, as well as different object structure.

Under Android a call to https://api.twitter.com/1.1/users/show.json?user_id=${uuid} will get user data. But under iOS twitter sends an error object ("user not found"), because UUID is wrong.

Could you please explain this?

Regards.

SekibOmazic avatar Jan 23 '17 19:01 SekibOmazic

I am uuid null on Android.

roshangm1 avatar Mar 29 '17 09:03 roshangm1

Hi,

I have different response for twitter and facebook on iOS. Access token could be the same.

type OAuthResponse = {
  response: {
    authorized: boolean,
    credentials: {
      accessToken?: string, // facebook
      access_token?: string, // twitter
      authorizationHeader?: string, // facebook
      access_token_secret?: string, // twitter
      clientID?: string, // facebook
      clientSecret?: string, // facebook
      scopes?: Array<string>, // facebook
      type?: number, // facebook
    },
    identifier: string,
    uuid: string,
  },
  status: Status,
};

martin-badin avatar Jan 04 '18 07:01 martin-badin