CapacitorGoogleAuth icon indicating copy to clipboard operation
CapacitorGoogleAuth copied to clipboard

feat: add additional scopes request

Open reslear opened this issue 3 years ago • 5 comments

Feature for simple request adding/removing additional scopes already authorised user

addScopes

  • [x] ts types
  • [ ] Web
  • [ ] Android
  • [ ] iOS
  • [ ] docs

removeScopes

  • [x] ts types
  • [ ] Web
  • [ ] Android
  • [ ] iOS
  • [ ] docs

closes: #158

reslear avatar Jan 04 '22 04:01 reslear

hi @joeflateau need you help with this, and is need sponsoring you work) separate function from https://github.com/CodetrixStudio/CapacitorGoogleAuth/blob/27f0111d1a03e5b22a4788376f0869ea7c55a215/ios/Plugin/Plugin.swift#L67-L73

reslear avatar Jan 04 '22 04:01 reslear

@reslear agree it would be good to add the "addScope" function, but I don't believe that would close #158, they seem unrelated.

joeflateau avatar Jan 04 '22 15:01 joeflateau

@joeflateau #158 is example, but in my case need get google contacts from address book

In my onboarding screen app, login with google is required, is i'm set scopes

['profile', 'email', 'openid', 'https://www.googleapis.com/auth/contacts.readonly']

most people don't share contacts and leave the app 😨

but if we logged in a user with default areas ['profile', 'email', 'openid'], and somewhere in the application we made an optional button to share contacts


async function getContacts() { 
  
  // TODO: maybe need add checkScopes ?
  await GoogleAuth.addScopes([
    'https://www.googleapis.com/auth/contacts.readonly'
  ])

  const { result } = await gapi.client.people.people.connections.list({
     'resourceName': 'people/me',
     'personFields': 'names',
   })
   
   return result.connections.map((person) => person.names[0].displayName)
}

reslear avatar Jan 05 '22 03:01 reslear

web https://developers.google.com/identity/sign-in/web/incremental-auth#step_2_request_additional_scopes

reslear avatar Jan 07 '22 05:01 reslear

@hoi4 maybe you help for this?

reslear avatar Feb 01 '22 20:02 reslear