Score:-1

Using custom scheme (myapp://dashboard) in drupal simple-oauth2 module's redirect url

gp flag

How can I use custom scheme i.e. myapp://dashboard for the redirect field of Drupal simple oauth2 module?

I get this error: 'myapp://dashboard is not a valid url'

I also tried to use the redirect module to redirect a node to this url but I got the same- invalid url error.

Tejas avatar
gp flag
It seems drupal validate urls and allows only https and http. Is there a way for adding an exception?
Kevin avatar
in flag
https://www.drupal.org/project/drupal/issues/2031149
id flag
Does this answer your question? [How do I manually configure the Link module?](https://drupal.stackexchange.com/questions/263399/how-do-i-manually-configure-the-link-module)
Score:0
gp flag

I have found 3 ways to do this:

  1. Create a node, in the oauth2 redirect add this node's url, using redirect module redirect this node to your custom scheme eg: myapp://dashboard.

  2. Use deep linking or App Links in your app and website, verify your ownership and use Intent in your native app. Now whenever oauth2 module will redirect after verification (https://your.site/login/callback node), your app's requested screen will open and oauth2 login/authentication will get completed automatically!

  3. (NOT the best method) I followed Cliefen's advice, updated the list of filter_protocols and edited the required cell in the 'consumers' table of the database. Now it works perfectly fine! (Clear your cache)

Score:0
id flag

Yes you can add an exception. If you do not already have a services.yml file, copy default.services.yml to services.yml. In services.yml update the list of filter_protocols to contain the custom protocol.

Tejas avatar
gp flag
Hey Clifen, I just tried it in the Redirect module's (/admin/config/search/redirect/add) redirect to field and it worked. But it failed to work in the Simple Oauth2 Module's redirect field ("The URL myapp://dashboard is not valid"). Do you have any idea how to resolve it?
id flag
On which route of that module do you add that URL? Also, OAuth 2, as in, implementations of the protocol itself, may refuse to do this. I'm not sure.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.