diff --git a/OAuth2-Front-Approach.md b/OAuth2-Front-Approach.md index 9e8dd35..3d0bb5e 100644 --- a/OAuth2-Front-Approach.md +++ b/OAuth2-Front-Approach.md @@ -50,7 +50,7 @@ A way for the `user` to tell `google` to give an access token to `xorismesiti.gr
-

Frontend HTTP GET Request to Google

+

HTTP GET Request from Frontend to Google

```sh GET https://accounts.google.com/o/oauth2/v2/auth? @@ -70,7 +70,7 @@ GET https://accounts.google.com/o/oauth2/v2/auth?
-

Google HTTP Response to Frontend

+

HTTP GET Response from Google to Frontend

```bash HTTP/1.1 302 Found @@ -117,7 +117,7 @@ const loginWithGoogle = () => { Now that the frontend has the Authorization `code` on th callback url https://xorismesiti.gr/api/auth/callback`?code=AAAABCX4XfWgyVyziyLg0QHHHHH` it can send it to the backend with POST to `xorismesiti.gr/api/auth/exchange-token`
-

Frontend HTTP POST Request to Backend

+

HTTP POST Request from Frontend to Backend

```bash POST https://xorismesiti.gr/api/auth/exchange-token @@ -144,7 +144,7 @@ Content-Type: application/json *Security: The backend never expose the client_secret to the frontend. This step should always be handled on the backend.*
-

Backend HTTP POST Request to Google

+

HTTP POST Request from Backend to Google

```sh POST https://oauth2.googleapis.com/token @@ -171,7 +171,7 @@ client_secret=PASS1234
-

Google HTTP Response Backend

+

HTTP POST Response from Google to Backend

```json { @@ -288,7 +288,7 @@ export default Callback; 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
-

Backend HTTP Response to Frontend

+

HTTP Response from Backend to Frontend

```json { @@ -318,7 +318,7 @@ The frontend gets the tokens from the backend response, and saves them somewhere 3. Make authenticated requests directly to Google API
-

Frontend HTTP GET Request to Backend

+

HTTP GET Request from Frontend to Backend

```bash GET https://www.googleapis.com/oauth2/v3/userinfo @@ -328,7 +328,7 @@ Authorization: Bearer ACCESSTOKEN6zXZkHi2XITkDoOVACCESSTOKEN
-

Backedn HTTP Response to Frontend

+

HTTP GET Response from Backend to Frontend

```json { @@ -396,7 +396,7 @@ const fetchUserData = async (accessToken) => { If the access token is expired, the frontend will receive an error response from Google when attempting to fetch user data
-

Frontend HTTP GET Request to Google

+

HTTP GET Request from Frontend to Google

```bash GET https://www.googleapis.com/oauth2/v3/userinfo @@ -406,7 +406,7 @@ Authorization: Bearer ACCESSTOKEN6zXZkHi2XITkDoOVACCESSTOKEN
-

Google HTTP Response to Frontend

+

HTTP GET Response from Google to Frontend

```json { @@ -419,7 +419,7 @@ Authorization: Bearer ACCESSTOKEN6zXZkHi2XITkDoOVACCESSTOKEN
-

Frontend HTTP POST Refresh token to Backend

+

HTTP POST Refresh token from Frontend to Backend

```bash