Skip to content

MS graph access token from FlutterFire signInWithAuthProvider #10499

Answered by prggTheProgrammer
fatima03 asked this question in Q&A
Discussion options

You must be logged in to vote

Well, the sigInInWithAuthprovider method returns a credential like so:
cred = await FirebaseAuth.instance.signInWithProvider(provider);
You can than get the oauth access token like so:
cred.credential!.accessToken!

You then need to call MS graph with the Authorization header:

http.Response res = await http.get(
    Uri.https("graph.microsoft.com", "v1.0/me"),
    headers: {"Authorization": "Bearer $token"});

If you still have any questions, feel free to ask.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fatima03
Comment options

Answer selected by fatima03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants