cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OAuth2.0 throws invalid_grant type message while fetching the tokens from Xamarin forms Android app

OAuth2.0 throws invalid_grant type message while fetching the tokens from Xamarin forms Android app

codecat15
New member | Level 2

I am using OAuth2.0 in my xamarin application and when i try to get the access token using the OAuth settings mentioned below I am able to get the access token, post my image on dropbx and everything works fine.

 

Configurations used in OAuth2.0

 

private const string Dbx_ClientId = "DROPBOX-APP-CLIENT-ID";
private const string Dbx_Secret = "DROPBOX-APP-CLIENT-SECRET";
private const string Dbx_AuthUrl = "https://www.dropbox.com/oauth2/authorize";
private const string Dbx_AccessTokenUrl = "https://api.dropboxapi.com/oauth2/token";
private const string Dbx_CallBack = "https://www.dropbox.com/callback";

 

The library used to do the OAuth2.0 call from Xamarin app is Xamarin.Auth version 1.5.0.3.

 

It's just I don't know why it shows an invalid_grant message to the user before it does that. I am doing the same thing in iOS and over there it never shows this message however when am working with android it shows this message. 

 

Do i need to pass something else when am trying to call the service through android?

Screenshot_1521146545.png

 

Screenshot_1521146590.png

 

 

 Please let me know what's the right way of doing this to avoid seeing the invalid_grant messages. 

3 Replies 3

Greg-DB
Dropbox Staff
Are you able to print out the full /oauth2/token HTTP response body for this error? It should contain a more detailed error message along with 'invalid_grant'.

Also, why are you using "https://www.dropbox.com/callback"? That's not a valid page on dropbox.com. (You can use https://www.dropbox.com/1/oauth2/redirect_receiver if you want though.)

codecat15
New member | Level 2

Thanks for the suggestion for the redirect url, since i am doing this in a mobile application the blocker that i am facing is it shows invalid_grant message for like 2seconds on the screen and then vanishes and takes me back to my mobile app with the token.

 

What i can do is wrap everything i did for my xamarin project and send it to you for reference and then maybe you can have a look at it if my explanation is not clear through comments or i can send a video too let me know

Greg-DB
Dropbox Staff
Can you print out the actual /oauth2/token HTTP response body? That would be the best way to troubleshoot this.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    codecat15 New member | Level 2
What do Dropbox user levels mean?