Dear All,
I’m creating mobile app using react-native. For regular login (email/password) already works. But, I want to add Google Seamless SSO.
After, choosing a google account and accept the permission request, it successful. But it can’t access another endpoints like /users/me because it didn’t have correct directus token. How to exchange from google token to directus token? Please help. TIA.
Google userInfo structure: {
“type”: “success”,
“data”: {
“scopes”: [
“``https://www.googleapis.com/auth/userinfo.profile”``,
“``https://www.googleapis.com/auth/userinfo.email”``,
“openid”,
“profile”,
“email”
],
“serverAuthCode”: “4/0AVMBsJi7Oj–redacted–p_xG_Ba9NtJViLWkoyXLyyklz6qPqs7P30kLgJL7bHKw”,
“idToken”: “eyJhbGciOiJSUzI1NiIsImtpZCI6IjE0OTljMTU0Y2NjOGEyNWUyNGQ4ZGU4YjFhOWY4NDVhZWZiNmYzY2EiLCJ0eXAiOiJKV1QifQ.eyJpc–redacted–tdP2S6HutKqzTqEAlItFCt9HuqfXDLFmnT4nIa9x_DXuLbaeg3o8TTJc6QvQ”,
“user”: {
“photo”: “``https://lh3.googleusercontent.com/a/ACg8ocIqgXsDHDSxNFQ5G8–redacted–4g=s96-c”``,
“givenName”: “Yo”,
“familyName”: null,
“email”: “yo–redacted–@gmail.com”,
“name”: “Yo”,
“id”: “10906–redacted–638106”
}
}
}
1. is it like /items/google_verify endpoint? How to exchange google token to directus token? 2. still same question: how to exchange google token to directus token? Maybe you have ideas, because in web directus use same method like exchange google token to directus token. But what endpoint? From this point, i'm starting to explore supabase instead directus. How do you think?
– ymysI am sorry, but I never implemented it myself. I just learned the above steps from my colleague, maybe this can help you https://github.com/directus/directus/discussions/11080
– ahmad_quvor