2

I am trying to authenticate to Azure using this library 'react-native-azure-ad2' but it seems like it is not working properly. After I login it displays this error message:

"Sorry, but we're having trouble signing you in. The reply url specified in the request does not match the reply URLs configured for the application 'xxxxxxxxxxxxxxxxxxxxxx'

Here is my code:

    var credentials = {
    client_id: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx',
    client_secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    redirectUrl: 'msalxxxxxxx-xxxxxx-xxxxx-xxxxx-xxxxxxxxxx://auth',
    scope: 'User.Read'
};

export default class AzureLogin3 extends React.Component {

    constructor(props) {
        super(props);
        this.azureInstance = new AzureInstance(credentials);
        this._onLoginSuccess = this._onLoginSuccess.bind(this);
    }

    _onLoginSuccess() {
             this.azureInstance.getUserInfo().then(result => {
             console.log(result);
           }).catch(err => {
            console.log(err);
        })
    }

    render() {
        return (
            <AzureLoginView
                azureInstance={this.azureInstance}
                loadingMessage="Requesting access token"
                onSuccess={this._onLoginSuccess}
            />
        );
    }
}

I have tried all of those credentials and combined in different ways but the error message remains the same.

showtime
  • 1
  • 1
  • 17
  • 48
  • 1
    It's not related with your question but it's a good practice to use `.env` to handle your credentials :) https://github.com/zetachang/react-native-dotenv – David Leuliette Jun 17 '19 at 15:50

1 Answers1

0

I think the redirectUrl in your code does not match with the one in registered Azure application's Redirect URI.

Rango
  • 1,954
  • 4
  • 14
  • 14