What values i can pass to scope apart from empty string ("") to OAuth2Authenticator constructor in Xamarin.Auth?

Please refer to the below link for more information on OAuth2Authenticator usage https://components.xamarin.com/gettingstarted/xamarin.auth

2

There are 2 best solutions below

1
On BEST ANSWER

Well It depends on the Authentication Provider you are making use of. Let me explain you this in detailed, say for example ,

  1. you want to authenticate users by their gmail accounts in that case ,you can use following scopes

For more information on OAuth with Google , you can refer to https://developers.google.com/+/web/api/rest/oauth

  1. You can refer to the below link for scope values ,if you want to authenticate users using Micrsoft as third party Authentication provider https://graph.microsoft.io/en-us/docs/authorization/permission_scopes

Similarly for other providers , check corresponding website documentation.

Hope this helps.

1
On

OAuth 2.0 Scopes are normally used to define what type of access (permission) that you are requesting. Thus if the access token is granted, only those scopes are assigned to that token, if you need to change the type of scope/permission needed say from a "read_only" scope to a "readwrite" scope, you have to request a new token using the new scope.

Scopes are dependent upon the service that you are trying to access and will be defined by that service, they are commonly used scopes, like "read_only", but again, the service defines what they are.

I.e. To ask for permission for read and write permissions and offline access at the same time to user's Microsoft OneDrive account you would ask for this scope:

"onedrive.readwrite wl.offline_access"

To access a Google Calendar, you might ask for only view access (read only) via the scope:

"https://www.googleapis.com/auth/calendar.readonly"

To change/manage the user's calendar, you would ask for:

"https://www.googleapis.com/auth/calendar"

When requesting multiple scopes at one, you might need to separate each scope by a space or a comma or some other service defined delimiter. While the space delimiter is very common, again this is defined by the service you are interfacing.

Ref: Access Token Scope / https://www.rfc-editor.org/rfc/rfc6749#page-23