Update OAuth2-Front-Approach.md
This commit is contained in:
parent
e186b2ee0c
commit
26e6566b01
@ -279,7 +279,11 @@ app.listen(3000, () => {
|
|||||||
|
|
||||||
#### 2.3 Front
|
#### 2.3 Front
|
||||||
|
|
||||||
The frontend gets the tokens from the backend response, and saves them somewhere secure. Now its ready to use the tokens to get the user data from Google
|
The frontend gets the tokens from the backend response,
|
||||||
|
|
||||||
|
and saves them in a cookie marked as `HTTP-only` and `Secure`
|
||||||
|
|
||||||
|
Now its ready to use the tokens to get the user data from Google
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><h3>HTTP Response from Backend to Frontend</h3></summary>
|
<summary><h3>HTTP Response from Backend to Frontend</h3></summary>
|
||||||
@ -298,6 +302,22 @@ The frontend gets the tokens from the backend response, and saves them somewhere
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h3>Frontend Code:</h3></summary>
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Set an HTTP-only, Secure cookie on the backend
|
||||||
|
res.cookie('access_token', accessToken, {
|
||||||
|
httpOnly: true,
|
||||||
|
secure: true,
|
||||||
|
maxAge: 3600000 // 1 hour expiry
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user