Ran on ios in expo go.
Authorization token works correctly but then cannot redeem. Gives me the error below, I looked but the solution to this error is an to put an origin header, which isn't possible in ios.
在EXPO GO中运行iOS。授权令牌工作正常,但无法兑换。给了我下面的错误,我看了一下,但这个错误的解决方案是放置一个起始头,这在iOS中是不可能的。
More info: AADSTS9002327: Tokens issued for the 'Single-Page Application' client-type may only beredeemed via cross-origin requests.
更多信息:AADSTS9002327:为‘Single-Page Application’客户端类型颁发的令牌只能通过跨域请求进行兑换。
const discovery = AuthSession.useAutoDiscovery('https://login.microsoftonline.com/' + tenantId +'/v2.0');
const redirectUri = AuthSession.makeRedirectUri({scheme: "{my scheme}", path: 'auth'});
// Request
const [request, result, promptAsync] = AuthSession.useAuthRequest(
{
clientId,
scopes: ["User.Read"],
redirectUri,
prompt: AuthSession.Prompt.SelectAccount
},
discovery,
);
async function getAuthToken() {
promptAsync().then(async (codeResponse) => {
if (request && codeResponse?.type === 'success' && discovery) {
AuthSession.exchangeCodeAsync(
{
clientId,
code: codeResponse.params.code,
extraParams: request.codeVerifier
? { code_verifier: request.codeVerifier }
:undefined,
redirectUri,
scopes: request.scopes
},
discovery,
).then((response) => {
//Success
}).catch(e => {console.log(e)});
}
});
}
I have tried getting the token like in the repo https://github.com/pinecat/azure-ad-graph-expo
我试过像在回购https://github.com/pinecat/azure-ad-graph-expo得到令牌
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!