Update OAuth2-Backend-Approach.md
This commit is contained in:
parent
de22182f22
commit
8b780a97eb
@ -143,13 +143,23 @@ app.get('/auth/google/callback', async (req, res) => {
|
|||||||
|
|
||||||
# 3. Use Token
|
# 3. Use Token
|
||||||
|
|
||||||
1. Front **GET** profile data from Back `https://xorismesiti.gr/api/auth/profile` using the `cookie`
|
### 1. Frontend **GET** profile data from Backend
|
||||||
2. Back **GET** profile data from Google `https://www.googleapis.com/oauth2/v3/userinfo` using the `access_token` from Front `cookie`
|
|
||||||
3. Google **response** to Back with profile data
|
|
||||||
4. Back **response** to Front with profile data
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X GET https://xorismesiti.gr/api/auth/profile \
|
||||||
|
-H "Cookie: access_token=ya29.a0AfH6SMC8Op6zXZkHi2XITkDoOVzYXt3hTY6sny54UlWlxrnKlX5Xv78is7BEHekVX-VoA" \
|
||||||
|
-H "Accept: application/json"
|
||||||
|
```
|
||||||
|
|
||||||
3. Google **response** to Back with profile data
|
### 2. Backend **GET** profile data from Google `https://www.googleapis.com/oauth2/v3/userinfo` using the `access_token` from Front `cookie`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X GET "https://www.googleapis.com/oauth2/v3/userinfo" \
|
||||||
|
-H "Authorization: Bearer {access_token}" \
|
||||||
|
-H "Accept: application/json"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Google **response** to Back with profile data
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
@ -165,9 +175,7 @@ app.get('/auth/google/callback', async (req, res) => {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 4. Back **response** to Front with profile data
|
||||||
|
|
||||||
4. Back **response** to Front with profile data
|
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user