OAuth2 Helpers
This contains helpers for google.accounts.oauth2 namespace.
hasGrantedAllScopes()
Section titled “hasGrantedAllScopes()”- Type
function hasGrantedAllScopes( tokenResponse: TokenResponse, firstScope: string, ...restScopes: string[]): boolean;- Details
Helper method to access google.accounts.oauth2.hasGrantedAllScopes
Checks if the user granted all the specified scope or scopes.
- Example
import { hasGrantedAllScopes } from "vue3-google-signin";
const tokenResponse = // token response from googleconst result = hasGrantedAllScopes( tokenResponse, "profile", "email", "https://www.googleapis.com/auth/drive");
console.log(result);- See More: Docs
hasGrantedAnyScopes()
Section titled “hasGrantedAnyScopes()”- Type
function hasGrantedAnyScopes( tokenResponse: TokenResponse, firstScope: string, ...restScopes: string[]): boolean;- Details
Helper method to access google.accounts.oauth2.hasGrantedAnyScopes
Checks if the user granted any the specified scope or scopes.
- Example
import { hasGrantedAnyScopes } from "vue3-google-signin";
const tokenResponse = // token response from googleconst result = hasGrantedAnyScopes( tokenResponse, "profile", "email", "https://www.googleapis.com/auth/drive");
console.log(result);- See More: Docs
revokeAccessToken()
Section titled “revokeAccessToken()”- Type
function revokeAccessToken(accessToken: string, done?: () => void);- Details
Helper method to access google.accounts.oauth2.revoke
The revoke method revokes all of the scopes that the user granted to the app. A valid access token is required to revoke the permission.
- Example
import { revokeAccessToken } from "vue3-google-signin";
revokeAccessToken("ACCESS TOKEN FROM GOOGLE", () => { console.log("Token revoked");});- See More: Docs