shedaltd / react-native-azure-ad-2

A React Native module for Microsoft Azure Identiry Authentication version 2. Implemented using pure Javascript and no others lib
MIT License
47 stars 71 forks source link

CompactToken parsing failed with error code #45

Open priyankatech2513 opened 2 years ago

priyankatech2513 commented 2 years ago

unable to login getting below error please suggest solution {"error": {"code": "InvalidAuthenticationToken", "innerError": {"client-request-id": "02be882d-a85d-4d05-87ef-03df8deeab26", "date": "2022-07-19T11:36:45", "request-id": "02be882d-a85d-4d05-87ef-03df8deeab26"}, "message": "CompactToken parsing failed with error code: 80049217"}}

DeepakSharma04 commented 2 years ago

Pass tenant ID --https://login.microsoftonline.com/

e.g.const CREDENTIAILS = { authority:'https://login.microsoftonline.com/XXXXXXXXXXXXXXXXXX', client_id: 'XXXXXXXXXXXXXXXX', client_secret: 'XXXXXXXXXXXXXXX', redirect_uri: 'XXXXXXXXXXXXXXXXXXXXXX', scope: 'https://graph.microsoft.com/.default' };

And change the lines in AzureInstance.js

constructor(credentials) { this.authority = credentials.authority; this.authorize_endpoint = '/oauth2/v2.0/authorize'; this.token_endpoint = '/oauth2/v2.0/token'; this.redirect_uri = credentials.redirect_uri; this.client_id = credentials.client_id; this.client_secret = credentials.client_secret; this.scope = credentials.scope; this.token = {};

    // function binding
    this.getConfig = this.getConfig.bind(this);
    this.setToken = this.setToken.bind(this);
    this.getToken = this.getToken.bind(this);
    this.getUserInfo = this.getUserInfo.bind(this);
}