-3

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.

3

2 Answers 2

0

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.

2
  • 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?
    – Tejas
    Commented Aug 30, 2023 at 15:01
  • 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.
    – mona lisa
    Commented Aug 30, 2023 at 15:07
0

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.