使用MIcrosoft Graph(accessToken)进行Firebase身份验证 [英] firebase auth with MIcrosoft Graph (accessToken)

查看:140
本文介绍了使用MIcrosoft Graph(accessToken)进行Firebase身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常希望有人能帮助我-我有点被困住了.

I am super hopeful someone can help me - I'm kind of stuck.

我很高兴在Microsoft AD中使用firebase auth.我的AuthProvider是firebase.auth.OAuthProvider('microsoft.com').

I'm happily using firebase auth with Microsoft AD. My AuthProvider is firebase.auth.OAuthProvider('microsoft.com').

当我通过该提供者致电firebase.auth().signInWithPopup()时,一切都很好.我可以从生成的UserCredential中选择accessToken并访问Microsoft Graph api没问题(是!).

When I call firebase.auth().signInWithPopup() with that provider, everything works GREAT. I can pick out the accessToken from the resulting UserCredential and access Microsoft Graph api's no problem (yay!).

Firebase持续存在并更新身份验证,当用户稍后返回我的SPA时(也是),我的应用通过新的firebase.User通过onAuthStateChanged获得预期的回调.

Firebase persists and renews the authentication and my app gets the expected callback via onAuthStateChanged with the new firebase.User when the user returns to my SPA later (also yay!).

坏消息(卡住了)是:如何在此流程中获取Microsoft Graph accessToken (例如,当用户返回到我的应用稍后)?我不希望他们必须通过另一个弹出窗口(yech)重新进行身份验证.

The bad news (where I'm stuck) is: how do I get the Microsoft Graph accessToken in this flow (e.g. when the user returns to my app later)? I don't want them to have to re-authenticate with another popup (yech).

基本上,当用户返回时,如何从有效的firebase.User变为MS图形accessToken?

Basically, how do I go from a valid firebase.User to a MS Graph accessToken when the user returns?

非常感谢您的帮助!

推荐答案

Firebase Auth仅关注身份验证.他们将在成功通过UserCredential登录后返回OAuth访问令牌,但会丢弃Microsoft OAuth刷新令牌,并且不存储与提供者关联的任何OAuth凭据.因此,您之后将无法获得新的访问令牌.如果您有充分的理由让Firebase Auth管理OAuth访问令牌,请提交官方功能请求.

Firebase Auth only focuses on authentication only. They will return the OAuth access token on sign in success via UserCredential but will discard the Microsoft OAuth refresh token and not store any OAuth credential associated with the provider. So you have no way to get a new access token afterwards. If you have a good reason for Firebase Auth to manage OAuth access tokens, please file an official feature request.

这篇关于使用MIcrosoft Graph(accessToken)进行Firebase身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆