I've been assigned a project that I have to finish for the end of the scholar year, and I have to create a mobile app that other students of my Uni could use.
I'm using flutter and Firebase to create the app, but I have to check if the user is a member of the university. To do so he has to enter his university credentials into my application.
This would mean I have to fetch an authentification token from the university website and then pass it to Firebase to access the application's data right? If so, how can I sign in Firebase using a custom token? I've seen examples but they all create a custom token themselves first (instead of fetching it from a website)
Link from what I found for the custom token: ( https://firebase.google.com/docs/auth/admin/create-custom-tokens#:~:text=Firebase%20gives%20you%20complete%20control,via%20the%20signInWithCustomToken()%20method.)
You have to create a Node API which your app will hit the endpoint when somebody tries to log in. The API has to communicate with your university's website and get the token and return it as the response. Once you get the token response from your API on your app, you have to pass it to the signInWithCustomToken method as such.
FirebaseUser.signInWithCustomToken(token: customToken);
This solution may seem like a huge task, which it is. But from a performance point of view, you will be reducing the load your app has to handle. All your app has to do is pass the email id entered as the query to the API, and the node will do all the heavy lifting, leaving your app light.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With