我已经将Microsoft团队整合在我的项目中,用户可以代表他/她的团队创建会议。但是现在,我想为用户提供一个选择以断开其帐户的连接,即我们将不再能够代表用户创建会议。
我在这个流程中面临的问题很少:
- 我找不到可以代表用户发送请求的API
使访问/刷新令牌无效。
- 如果我删除了我的尽头存储的令牌,然后用户再次尝试将其Microsoft帐户与我们的网站连接起来,它将不再要求用户的同意(OAuth的基本要求)提供访问我们的应用程序(如果用户在Microsoft中登录用户,则在浏览器上,他/她看不到同意页面,帐户与我们的网站直接连接,我们获得了刷新/访问令牌)。
有人可以帮我吗?
最后,当用户再次尝试将其Microsoft帐户与我们的应用程序连接时,他/她会看到“同意”页面(每次他尝试连接帐户),然后用户单击“允许”按钮,这将使我们访问时和刷新令牌。
I have integrated microsoft teams in my project where a user can give us access to create meetings on teams on his/her behalf. But now I want to give the user a option to disconnect his/her account i.e. we will no longer be able to create meetings on user's behalf.
I am facing few problems in this flow:
- I am unable to find an API where I can send request on user's behalf
to invalidate a access/refresh token.
- If I remove the token stored at my end and then user again tries to connect their Microsoft account with our website it no longer asks for user's consent(which is basic requirement for OAuth) to give access to our app(if user is logged in Microsoft account on the browser he/she do not see the consent page and account is directly connected with our website and we get the refresh/access token).
Can someone help me on this?
At the end all what I want is when user tries again to connect his/her Microsoft account with our app he/she see the consent page(every time he tries to connect account) and then user clicks the allow button which will give us access and refresh token.
发布评论
评论(3)
提示用户进入同意页面的替代解决方案只是仅附加
strips = oauth2 uri Prameters中的
:= xxxxxxxxxxxxxxxxxxx&state = xxx = xxx = xxx& ↑↑
此处您可以找到有关参数的文档。
An alternative solution for prompting the user to the consent page is just simply appending the
prompt="consent"
in the OAuth2 URI prameters:https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=xxx&redirect_uri=xxx&scope=xxx&state=xxx&access_type=offline&prompt=consent
_____↑↑↑↑↑↑
Here you can find the documentation about the parameters.
如果用户授予对应用程序的访问权限,则Azure AD将向资源发布访问令牌和刷新令牌。
访问令牌的寿命通常约为1小时。在其一生中,即使删除了应用程序,它仍然可以使用,但是您将无法使用刷新令牌再次获得访问令牌。
1)要代表用户无效访问令牌,请参阅此 doc 。
2)用于使用刷新令牌获取访问令牌,请参阅此 doc 。
希望这有帮助。
If the user has granted access to the application, Azure AD will issue an access token and a refresh token for the resource.
The lifetime of the access token is usually about 1 hour. During its lifetime, even if the application is deleted, it is still available, but you will not be able to use the refresh token to obtain the access token again.
1)To invalidate access token on users behalf, Refer this DOC.
2)For fetching the access token using the refresh token please refer this DOC.
Hope this helpful.
请参阅 MSGRAPH端点。
您可以为签名用户或其他用户删除所有刷新令牌。
使用此问题的一种简单方法是与 Microsoft Graph Explorer
https://graph.microsoft.com/v1.0/me/revokesigninsessions
以撤销自己的令牌,https://graph.microsoft.com/v1 .0/用户/{userId}/revokeSignInsessions
撤销另一个用户的令牌。当心,这不会使访问令牌无效,而访问令牌并非被设计为无效。申请仍然可以访问,直到其访问令到期为止。
See the revokeSignInSessions MSGraph endpoint.
You can revoke all refresh tokens for the signed-in user or another user by id.
An easy way to use this is with the Microsoft Graph Explorer:
https://graph.microsoft.com/v1.0/me/revokeSignInSessions
to revoke your own tokens,https://graph.microsoft.com/v1.0/users/{userId}/revokeSignInSessions
to revoke another user's tokens.Beware, this does not invalidate access tokens, which are not designed to be invalidated. Applications will still have access until their access token expires.