forked from civicteam/passport
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request passportxyz#734 from gitcoinco/google_abstraction
feat(google): this implements google abstraction
- Loading branch information
Showing
17 changed files
with
342 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// For details on the google oauth2 flow, please check the following ressources: | ||
// - https://developers.google.com/identity/protocols/oauth2 | ||
// - https://developers.google.com/oauthplayground/ | ||
|
||
import { PlatformOptions } from "../types"; | ||
import { Platform } from "../utils/platform"; | ||
|
||
export class GooglePlatform extends Platform { | ||
platformId = "Google"; | ||
path = "Google"; | ||
clientId: string = null; | ||
redirectUri: string = null; | ||
|
||
constructor(options: PlatformOptions = {}) { | ||
super(); | ||
this.clientId = options.clientId as string; | ||
this.redirectUri = options.redirectUri as string; | ||
} | ||
|
||
getOAuthUrl(state: string): Promise<string> { | ||
return new Promise((resolve) => { | ||
resolve( | ||
`https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${this.redirectUri}&prompt=consent&response_type=code&client_id=${this.clientId}&scope=email+profile&access_type=offline&state=${state}` | ||
); | ||
}); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
platforms/src/Google/app/Providers-config.ts → platforms/src/Google/Providers-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.