Update OAuth2-Backend-Approach.md
This commit is contained in:
parent
b5738633f7
commit
1a3afe914d
@ -1,6 +1,6 @@
|
|||||||
### OAuth2 purpose
|
### OAuth2 purpose
|
||||||
|
|
||||||
A way for the `user` to tell `google` to give an access token to `xorismesiti.gr` app
|
A way for the `user` to tell `google` to give an access to `xorismesiti.gr` app
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -8,9 +8,9 @@ A way for the `user` to tell `google` to give an access token to `xorismesiti.gr
|
|||||||
|
|
||||||
| When | What | How |
|
| When | What | How |
|
||||||
|-------|--------------------------|:------------------------------------------------:|
|
|-------|--------------------------|:------------------------------------------------:|
|
||||||
| 1 | Get Code | Front ⇢ Google ⇢ Front |
|
| 1 | Get Code | Front ⇢ Google ⇢ Front |
|
||||||
| 2 | Exchange Code with Token | Front ⇢ Back ⇢ Google ⇢ Back ⇢ Front |
|
| 2 | Exchange Code with Token | Front ⇢ Back ⇢ Google ⇢ Back ⇢ Front |
|
||||||
| 4 | Use Token | Front ⇢ Google ⇢ Front |
|
| 4 | Use Token | Front ⇢ Back ⇢ Google ⇢ Back ⇢ Front |
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -27,11 +27,15 @@ A way for the `user` to tell `google` to give an access token to `xorismesiti.gr
|
|||||||
1. Frontend **POST** the authorization `code` to the Backend
|
1. Frontend **POST** the authorization `code` to the Backend
|
||||||
2. Backend **POST** the authorization `code` to Google
|
2. Backend **POST** the authorization `code` to Google
|
||||||
3. Google **response** to Backend with an `access_token` and a `refresh token`
|
3. Google **response** to Backend with an `access_token` and a `refresh token`
|
||||||
4. Backend **response** to Frontend with an `access_token`
|
4. Backend **response** to Frontend with the `access_token` in a **cookie**
|
||||||
|
|
||||||
3. Use Token
|
3. Use Token
|
||||||
|
|
||||||
1. Frontend **Use** `access_token` to get user data from Google
|
1. Frontend **GET** profile data from Backend using the **cookie**
|
||||||
|
2. Backend **GET** profile data from Google using the `access_token` from Frontend **cookie**
|
||||||
|
3. Google **response** to Backend with profile data
|
||||||
|
4. Backend **response** to Frontend with profile data
|
||||||
|
5. Frontend render profile data
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user