Open kavitha57 opened 4 months ago
Azure has specific requirements in order to get the access token. Please see the links in the our documentation here.
I have the same issue with Azure B2C. I have referred the documentation referenced by @carbonrobot but unfortunately I could not find any info or extra steps related to getting the access token. This is the config I used : const config = { issuer: 'https://mytenant.b2clogin.com/tfp/mytenantID/my_b2c_user_flow_name/v2.0/', clientId: 'my-APP-ID-FROM-B2C', redirectUrl: 'my-react-native-app-screen-url', scopes: ['openid', 'profile', 'offline_access'], iosPrefersEphemeralSession: true, }; I need the access token as I need to call the UserInfo endpoint to get claims about the user. On the same lines, I think it will be useful if this library also provides a method to get user details by calling the Userinfo endpoint of B2C
I found the required info from @carbonrobot's another comment on similar issue
It was just adding the Azure App ID to the scope , the new config which returned the access code is below : const config = { issuer: 'https://mytenant.b2clogin.com/tfp/mytenantID/my_b2c_user_flow_name/v2.0/', clientId: 'my-APP-ID-FROM-B2C', redirectUrl: 'my-react-native-app-screen-url', scopes: ['my-APP-ID-FROM-B2C', 'openid', 'profile', 'offline_access'], iosPrefersEphemeralSession: true, };
In offline mode, the Access token returns null even added the "offline_access" in the scope
Here the scope
API_ACCESS_SCOPE: [ 'offline_access', 'api://xxxxxxxxxxxxxxxxxx/api-access', ],
getAzureApiAccessConfig() { return { issuer:
${MS_BASE_API_URL}${TENANT_ID}/v2.0
, clientId: APP_ID, redirectUrl: REDIRECT_URL, scopes: API_ACCESS_SCOPE,}
async getAccessTokenAsync() { try { const userInfo = await this.getUserInfo();
}
please help me what's went wrong?