I have a native app (react native) and API in go. Separately the authorization is working fine. My problem is when I try to use an access token from a native app and send it to API via an authorization header. The server is responding with an invalid token.
My use-case is that only logged-in user should be able to use gql server. Later I would add some permissions/roles to restrict mutations/queries further.
I assumed while working in the same account all APIs and applications can exchange tokens for validations. Is that assumption correct? What am I missing?
Let me add I use Development mode.
FYI I tried following your tutorials but with no luck.
Can you post the whole error? Is there a message about why it is being rejected? Also, can you please post an example token payload? You can use jwt.io to decode the token (please omit sensitive data).
For future generations and @dan.woda , I managed to solve the issue. The scope in auth settings was the problem. I had to set up the correct scope for auth call to retrieve the token. Seems that the scope to retrieve user information from social logins can’t be mixed up with API specific scope.
After reading docs some more it seems that good practice is to use 2 auth calls with different scopes:
first to retrieve tokens to login user in-app (react native app in my case)
second call to get token for future communication with the APIs