简体   繁体   English

如何使用我的后端中使用的前端反应中的 Auth0 访问令牌

[英]how to use Auth0 access token from frontend-react used in my backend

i'm trying to do a react app with a kotlin backend using auth0 as auth server.我正在尝试使用 auth0 作为身份验证服务器来做一个带有 kotlin 后端的反应应用程序。 I've the auth0-spa integrated in my react app so i can do a login, but the token i'm receiving ios an opaque token so when i'm sending to my app to authenticate my users, it's not a valid jwt (It's just a alphanumeric code without 3 jwt parts).我在我的反应应用程序中集成了 auth0-spa,因此我可以登录,但是我收到的令牌 ios 是一个不透明的令牌,所以当我发送到我的应用程序以验证我的用户时,它不是有效的 jwt(它只是一个没有 3 个 jwt 部件的字母数字代码)。

I'm reading that it's because auth0 spa framework does not allow to change response type to sokmething else than code so access token received it only works for /userinfo api os auth0.我正在阅读这是因为 auth0 spa 框架不允许将响应类型更改为除了代码之外的其他内容,因此收到的访问令牌仅适用于 /userinfo api os auth0。

My doubt is, how do i can use that token in my backend to validate it still using auth0-spa?我的疑问是,我如何在后端使用该令牌来验证它是否仍然使用 auth0-spa? Is there anyway or should i use auth0 non spa library?无论如何还是应该使用 auth0 非 spa 库?

You need to send the backend as an audience in the request for the token.您需要在令牌请求中将后端作为受众发送。 The opaque token is only valid for auth0 apis.不透明令牌仅对 auth0 api 有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM