Sanif SS
Sanif SS

Reputation: 642

What does Scope do in GoogleApiClient?

Can any one explain me what is this addScope(Scope scope) method does in GoogleApiClient.

new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)// what really does this?
.build();

Upvotes: 2

Views: 544

Answers (2)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116938

Scope defines the permissions you need to do what you need to do.

If you application needs to read from a users google drive account then you would request https://www.googleapis.com/auth/drive.readonly which grants you "read-only access to file metadata and file content" however if you need to be able to upload to google drive you may want to ask for https://www.googleapis.com/auth/drive which grants "Full, permissive scope to access all of a user's files."

Scope defines the scope of access an application is granted.

The scope in question Plus.login https://www.googleapis.com/auth/plus.login

This is the recommended login scope providing access to social features. This scope implicitly includes the profile scope and also requests that your app be given access to:
* the age range of the authenticated user
* the list of circled people that the user has granted your app access to know
* the methods for reading, writing and deleting app activities (moments) to Google on behalf of the user
In addition, this scope enables cross-platform single sign-on.

Upvotes: 2

csenga
csenga

Reputation: 4114

Scopes are strings that enable access to particular resources, such as user data.

Please see the doc and scopes summary.

Upvotes: 0

Related Questions