cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

Dropbox custom URL scheme

Dropbox custom URL scheme

squidlauncher64
Explorer | Level 3

I am developing an expo app. It needs to redirect back to the app after users have given authentication. When I was using expo go for basic testing this seemed to work fine but now that I am testing a development build and eventually a production build my process does not seem to work. I can navigate to dropbox.com/oauth2/authorize but returning to the app after receiving permission from the user seems to be the issue.   

 

In my app.json file I have:

  "expo": {
    "scheme": "myapp",

}

Here is how I build my redirect URI:

 

import * as AuthSession from 'expo-auth-session';
 
export function StartupAutheticationScreen() {
 
  const dropboxRedirURI = AuthSession.makeRedirectUri({path: 'Auth'});
... 
}

The authentication process works until i give permission. Once I click 'allow' I am not redirected to my app. Any help would be greatly appreciated. Thanks!

 

 

15 Replies 15

squidlauncher64
Explorer | Level 3

Ah ok I am using the api itself not the dropbox sdk. I should have clarified that. Sorry about the confusion. I am a novice at this. Here is a screenshot of what happens before i push the accept button: 

 

Untitled 2.png

 

 

squidlauncher64
Explorer | Level 3

After I push the button it greys out the accept button:

 

Untitled.png

 

 

squidlauncher64
Explorer | Level 3

Thank you for all your help!

Здравко
Legendary | Level 20

Doesn't matter whether you use SDK or not. Your screenshots just show that for some reason your schema is not able to activate any installed handler (including, but not only your application). Unfortunately, your screenshots don't carry too much information for details. In general different reasons can be, but may be set in 2 groups. First, your application may not be installed correctly as particular scheme handler. This is easier to check. Just put in your browser address line a URI that matches your application expectations (including the scheme). Does, after hitting enter key, your application get up in front of the browser? If Yes, the check is passed successfully, but if no you have some configuration mistake in the application and have to fix it. Second, redirect URI that comes from Dropbox after confirmation may not match to your idea. To see what comes there, an easy way is to copy your browser address line before hitting 'Allow' and paste in desktop browser address line. Usually there are tools letting you trace what's going on. In network tab you can see the redirect request (code 302,after hitting Allow) and find out What's in the 'location' response header. Does it match your (application') expectations, including schema? If Yes, it's Ok, but if no, you have mistake in URL, related to launching the linking process, construction (more careful focusing on the details may be needed).

Hope this gives direction.

squidlauncher64
Explorer | Level 3

So it fails the first check. Here are the guides i have been trying to follow: 

https://docs.expo.dev/guides/linking/#linking-to-your-app 

https://docs.expo.dev/guides/linking/

According to the documentation all I need is to put a scheme in the app.json file which I have done: 

Here is a snippet from the app.json: 
 "expo": {
    "scheme""myapp",

}

Then I use this in my authtnetication script: 

 

Here is how I build my redirect URI:

 

import * as AuthSession from 'expo-auth-session';
 
export function StartupAutheticationScreen() {
 
  const dropboxRedirURI = AuthSession.makeRedirectUri({path: 'Auth'});
console.log(dropboxRedurURI)
The console.log outptus "myapp://Auth", Is there something I am missing? Thanks again for all your help?

Здравко
Legendary | Level 20

@squidlauncher64 wrote:

So it fails the first check. ...


In such case your application cannot be launched and that's why your browser "freezes". At that moment the browser does exactly what you did - tries open the same URI - unsuccessfully. To be honest, I'm not familiar with your environment and cannot say what exactly is wrong or if is what you say enough. The only fact is that, as seems (according your words), the application is NOT registered as a handler properly. You have to check and fix whatever needed. The only thing I would advise is to check if all parameters are available in end package (for example, in Android manifest have to be registered an activity with appropriate intent filter, that matches your scheme). That would be a good start point, for instance. :winking_face:

Good luck.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    squidlauncher64 Explorer | Level 3
What do Dropbox user levels mean?