Update OAuth2-Front-Approach.md

This commit is contained in:
Ste Vaidis 2024-12-17 08:25:08 +02:00
parent 3da71c4acb
commit bcad93722a

View File

@ -16,14 +16,21 @@ A way for the `user` to tell `google` to give an access token to `xorismesiti.gr
### OAuth2 Frontend/Backend Flow Details: ### OAuth2 Frontend/Backend Flow Details:
1. Get Code
1. Frontend **Redirect** the user to Google's OAuth authorization endpoint `accounts.google.com/o/oauth2` 1. Frontend **Redirect** the user to Google's OAuth authorization endpoint `accounts.google.com/o/oauth2`
2. User **Login in** to Google and grant permissions 2. User **Login in** to Google and grant permissions
3. Google **Redirect** the user back to `xorismesiti.gr/callback` including the authorization `code` 3. Google **Redirect** the user back to `xorismesiti.gr/callback` including the authorization `code`
4. Frontend **Send** the authorization `code` to the Backend
5. Backend **Exchange** the authorization `code` for an `access_token` and `refresh token` 2. Exchange Code with Token
6. Backend **Send** `access_token` and `refresh token` to Frontend
7. Frontend **Store** `access_token` and `refresh token` to secure cookie 1. Frontend **Send** the authorization `code` to the Backend
8. Frontend **Use** `access_token` to get user data from Google 2. Backend **Exchange** the authorization `code` for an `access_token` and `refresh token`
3. Backend **Send** `access_token` and `refresh token` to Frontend
3. Use Token
1. Frontend **Use** `access_token` to get user data from Google
<br><br> <br><br>