Update OAuth2.md

This commit is contained in:
Ste Vaidis 2024-12-15 12:11:58 +02:00
parent 31f65b708a
commit 617142cba3

View File

@ -36,6 +36,9 @@ A way for the `user` to tell `google` to give an access token to `xorismesiti.gr
2. After this redirection, the user will log in to Google and grant permissions (if they havent already). 2. After this redirection, the user will log in to Google and grant permissions (if they havent already).
3. Google will redirect the user back to your specified redirect_uri with an authorization code. 3. Google will redirect the user back to your specified redirect_uri with an authorization code.
<details>
<summary><h3>HTTP Request</h3></summary>
```sh ```sh
GET https://accounts.google.com/o/oauth2/v2/auth? GET https://accounts.google.com/o/oauth2/v2/auth?
response_type=code& response_type=code&
@ -51,8 +54,10 @@ GET https://accounts.google.com/o/oauth2/v2/auth?
- `scope`: The permissions you're requesting (e.g., email, profile). - `scope`: The permissions you're requesting (e.g., email, profile).
- `state`: A random string to protect against CSRF attacks. - `state`: A random string to protect against CSRF attacks.
</details>
<details> <details>
<summary><h3>Example Frontent Code</h3></summary> <summary><h3>Frontent Code</h3></summary>
```js ```js
// Redirect to Google's OAuth 2.0 endpoint when user clicks login // Redirect to Google's OAuth 2.0 endpoint when user clicks login