Where to get Scopes dependencies for java for new Firebase Cloud Message API?

Viewed 3378

FCM Api was updated to v1, and now u can't pass key=<API_KEY> (once generated from FCM Console) header as before, now u should generate it by SDK com.google.api-client and there u should pass mystery SCOPES inside createScoped() method. Here is a lot of examples about it - without information about scopes. But what is this? where to get it? I can't to find any information about it. Please help me

3 Answers

The scope is list of String. I have tried several endpoints from https://developers.google.com/identity/protocols/googlescopes and worked.

  1. "https://www.googleapis.com/auth/firebase"
  2. "https://www.googleapis.com/auth/cloud-platform"
  3. "https://www.googleapis.com/auth/firebase.readonly"

    val googleCredential = GoogleCredential.fromStream("yourjson.json")            
    .createScoped(Arrays.asList("https://www.googleapis.com/auth/firebase", 
    "https://www.googleapis.com/auth/cloud-platform", 
    "https://www.googleapis.com/auth/firebase.readonly"))
    googleCredential.refreshToken()
    return googleCredential.accessToken
    
Related