Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Parameter Error when calling acquireTokenSilent method #17

Closed
KKamesh opened this issue Mar 6, 2019 · 8 comments
Closed

Invalid Parameter Error when calling acquireTokenSilent method #17

KKamesh opened this issue Mar 6, 2019 · 8 comments

Comments

@KKamesh
Copy link

KKamesh commented Mar 6, 2019

I am using the "react-native-azure-auth" library to implement Azure AD V2 login functionality in my react native app for iOS.

Issue 1:
When I call the "acquireTokenSilent" method after the AccessToken had expired, I am getting an error "Invalid Parameter: scope". I checked the source code and found that the parameters are not passed in the right format to the method "refreshTokens". The "refreshTokens" method expects a single object parameter but the "acquireTokenSilent" method invokes it with 2 separate parameters.

Issue 2:
Also, the refreshToken is a property within the refreshToken object returned by the method - "getRefreshToken".

I fixed both these issues by making the below code change locally in the file "auth/index.js". Kindly update the below line in the github repository for the benefit of all who use this library.

Fix :
File : auth/index.js Line: 192
const tokenResponse = await this.refreshTokens({refreshToken: refreshToken.refreshToken, scope: scope})

@SwagatRanjit84
Copy link

@KKamesh same error on android

@akashdmahali
Copy link
Contributor

@KKamesh lol you beat me to this by a day 😆 . I was facing the same issue and made the same fix

@SwagatRanjit84
Copy link

@akashdmahali How did you solve?

Error: The reply URL specified in the request doesn't match the reply urls configured for the application.

@akashdmahali
Copy link
Contributor

@akashdmahali How did you solve?

Error: The reply URL specified in the request doesn't match the reply urls configured for the application.

@SwagatRanjit84 you have to specify the reply urls while registering your app on azure.
This is the default format for specifying the reply urls :
${bundleIdentifier.toLowerCase()}://${bundleIdentifier.toLowerCase()}/${Platform.OS}/callback

Eg: lets say your bundle id is : com.yourcompany.yourapp , then the reply url would be

com.yourcompany.yourapp://com.yourcompany.yourapp/android/callback
com.yourcompany.yourapp://com.yourcompany.yourapp/ios/callback

@SwagatRanjit84
Copy link

@akashdmahali It is same format for all the cases? Are you saying Bundle ID = package name?

@akashdmahali
Copy link
Contributor

@akashdmahali It is same format for all the cases? Are you saying Bundle ID = package name?

yes that is correct, Bundle ID = package name. The format is same, but you can have different bundle ids (package name) for iOS and Android.

@SwagatRanjit84
Copy link

@akashdmahali yeah Got it!! thanks mate

@vmurin
Copy link
Owner

vmurin commented Mar 10, 2019

Hi guys!
Sorry for a long silence. I was on vacation.
Now the proposed change is applied and new version released.
So I can close the issue

@vmurin vmurin closed this as completed Mar 10, 2019
vmurin added a commit that referenced this issue Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants