How do I use the token generated by the Google auth?

I am using Refine with built in Google authorization process. I would like to use the token, because I see that in the "utils" folder there is the json parser. How can I use that token for access purposes, authenticate users and let them use some routes or use the token? I am using MongoDB as my database.
5 Replies
kapa.ai13mo ago
Hi @ging_freecs. I'm, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai13mo ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, I can provide you with some guidance on using Google authentication with Refine. You can follow the example provided in the Google Auth documentation ( to set up Google Login for your Refine project. As for using the token for access purposes and authenticating users, you can refer to the AuthProvider documentation ( and the Understanding AuthProvider tutorial ( to create a custom authentication provider that suits your needs. Unfortunately, I don't have any specific information on using MongoDB with Refine in the provided extracts. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Google Auth | refine
You can use Google Login to control access and provide identity for your app. This example will guide you through how to connect Google Login into your project using refine.
Auth Provider | refine
Auth provider is an object that contains methods to handle authentication and access control in your app by having refine consume them. These methods expect to return a promise, so they can be used with async methods.
1. Auth Provider | refine
What is auth provider?
kapa.ai13mo ago
<@296624290843983873> is still learning and improving, please let us how it did by reacting below
absent-sapphire13mo ago
Hey @ging_freecs, In the example, a simple check is used to check if there is a token in the local storage or not. If there is a token, the user is logged in. If not, the user is redirected to the login page. You can see the code here: However, in the real world, you should check the token with your backend. Refer to the google docs for more information: After you check implementation in your authProvider, you can use the useIsAuthenticated hook and <Authenticated> component to check if the user is authenticated or not.
unwilling-turquoise13mo ago
Thank you very much! This is helpful