Update OAuth2-Backend-Approach.md

This commit is contained in:
Ste Vaidis 2025-01-08 10:07:03 +02:00
parent 47bfbb6316
commit 12c65d6cbb

View File

@ -24,14 +24,14 @@ A way for the `user` to tell `google` to give an access to `myapp` app
2. Exchange Code with Token
1. Backend **POST** the `code` to Google `https://oauth2.googleapis.com/token`
1. Backend **POST** the `code` to Google
2. Google **Response** to Backend with an `access_token` and a `refresh token`
3. Backend **Redirect** to Frontend `https://myapp/auth/success` with the `access_token` in a `cookie`
3. Backend **Redirect** to Frontend with the `access_token` in a `cookie`
3. Use Token
1. Frontend **GET** profile data from Backend `https://myapp/api/auth/profile` using the `cookie`
2. Backend **GET** profile data from Google `https://www.googleapis.com/oauth2/v3/userinfo` using the `access_token`
1. Frontend **GET** profile data from Backend using the `cookie`
2. Backend **GET** profile data from Google using the `access_token`
3. Google **Response** to Backend with profile data
4. Backend **Response** to Frontend with profile data