2

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();
shareef
  • 9,255
  • 13
  • 58
  • 89
Sanif SS
  • 602
  • 5
  • 18

2 Answers2

2

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.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
0

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

Please see the doc and scopes summary.

csenga
  • 3,819
  • 1
  • 21
  • 31
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/10400941) – MrEngineer13 Dec 01 '15 at 15:00
  • @MrEngineer13 thanks! I will keep this in my mind in the future. – csenga Dec 01 '15 at 15:05