I've been trying to understand the oauth2 protocol lately and I think I have a decent understanding.
Here is a brief overview of how I understand Oauth Sign in in on a headless website:
- User want to log in on website, click google login
- Frontend redirects to portal with client_id
- User gives permission.
- Frontend recieved auth_code (in auth-code flow at least)
- frontend send auth-code to backend
- backend exchanges auth-code for acces-token. This requires client_secret and client_id.
- Backend exchanges acces-token for data
So if the frontend with client_id 'some-string' request permission and its granted. Then the backend with client 'some-string' and its associated client_secret is able get the user data.
Now I learn that other platforms (android, ios) need separate client_id's configured. This doesn't make sense to me. Can anyone explain that to me?