Spotify Web API Redirect Issue - spotify

I have set my redirect uri to something like this:
../index.php?r=spotifycollegeplaylists/tab/index
I was able to setup the login using this example
https://github.com/jwilsson/spotify-web-api-php
The login is working fine, I can trigger the login popup and I am able to login. Now the problem is with the redirection. After logging in I am redirected to this URL:
../index.php%3Fr=spotifycollegeplaylists/tab/index&page=index?code=AQCtOWUzHM
See the problem with the redirect is that it has two "?" If i manually change %3F to ? and ?code to &code, the links is working okay.using the method from the API above how will I be able to fix this issue?

I've made a query on the Spotify Web API site as well, and I got a feedback from one of their support team / developer.
"I understand your issue and I would recommend that you don't have any query parameters in your callback URLs. We have a known issue in that we don't allow the Redirect URI to include parameters and hopefully this will be fixed soon. Meanwhile, you could use the state parameter that you'll get back when the code is returned through the callback."

Related

Issue with Discord OAuth2 redirect_uri component

I'm currently working on Discord OAuth2 client for my web application.
No matter how hard I try to set the redirect_uri to make discord not send the error, I can't get fix it, and I keep getting this message:
Invalid OAuth2 redirect_uri : You can now close this tab.
(sorry for the foreign language in the second line)
My redirect_uri is:
const redirect = encodeURIComponent("http://localhost/callback");
(the website exists on the server and works as should.)
**I tried so many combinations, including:
- adding https:// instead of http://
- adding .com to the domain
- adding a slash after the word callback
- using normal string instead of encodeURIComponent
- generating the oauth2 redirect_uri via the Discord Developer page
**
The only thing that worked was totally removing the redirect_uri from the URL parameters, which made the app work, but didn't redirect to the correct place afterward;
(This is my oauth2 url):
https://discordapp.com/api/oauth2/authorize?client_id=${id}&redirect_uri=${redirect}&response_type=code&scope=identify%20guilds%20email,
when id = client id in string type and redirect = (above) the url
Thanks for any help.
Edit 1: setting the redirect_uri intentionally to a wrong URL, sends a JSON message saying "Badly formatted redirect_uri." (not the one visible on the screenshot!)
Edit 2: example complete url: https://discordapp.com/oauth2/authorize?client_id=528972063096963140&redirect_uri=http%3A%2F%2Flocalhost%2Fdiscord%2Fcallback&response_type=code&scope=identify%20guilds%20email
I got this issue today and after debugging a while around, I found what I was doing wrong.
While I registered my application on Discord, it asked me for a redirect_uri which we need to specify so that Discord can only allow those urls to redirect from the login page. But after fiddling a while on my project I changed the redirect url from node, which didn't match with what I already specified on Discord. That's why this issue popped up for me.
Screenshot from my discord developer dashboard (change this redirect url):
Fix: Go to Discord and update your new redirect url (as per your need). And this will fix the error on the login page that you're facing. Remember to save either by pressing enter in the field or by pressing the save-button that pops up at the bottom of the page.
Hope I could help!
I know this is resolved for a long time but i'm adding this in case someone has this issue and don't know what's happening: if you are calling the https://discord.com/api/oauth2/token endpoint to resolve a code to a token, you have to make the redirect_uri field the SAME as the one that generated the code with the https://discord.com/api/oauth2/authorize endpoint, otherwise you'll get this error. It also has to be, like mentioned above, EXACTLY (querystrings don't work) the same as one of the redirects in the redirects list of your application.
When using Next-Auth, I had success setting my redirect Url in discord settings as http://localhost:3000/api/auth/callback/discord

redirect URI is not registered properly with DocuSign

i am running the DOCUSIGN example code "eg-03-node-auth-code-grant" to check how embedded signing works(at https://localhost:5000). So after the signing is complete i would want it to return to another app. I have my other app running at localhost:8080.
In the Docusign developer sandbox account, i have added "https://localhost:8080/ds/callback" in the list of redirect URLs.
When i test the embedded signing code now, it gives me an error saying "Redirect URI is not registered properly with docusign"
What I ideally want is to build a separate docusign app for a consent process. once the consent is done, it goes to my other application to complete the rest of the study. For now, i was testing out with the example code it it redirects to another app but it doesnt. Am I missing something? other than registering the redirect URI in the integration key page, is there any change i need to make in the demo code for embedded signing to make it work?
As said in support : "There are two primary causes of this error, either an incorrect URI is being passed to DocuSign, or a correct URI has not been registered for the integration key."
I had the same problem, so i realized that appUrl was http://localhost:8080/ds/callback, but should be http:localhost:8080.
So you have to add too a Redirect URI of http://localhost:8080/ds/callback to your Integration Key in your eSignature Admin.
I hope i was clear and sorry for my bad english.
It's possible you're using incorrect environment, use account-d.docusign.com for Demo and account.docusign.com for Production when requesting for authorization code grant.
could this be https vs. http situation?
are you running it on your local at https://localhost:8080/ds/callback or http://localhost:8080/ds/callback? please check. It has to match exactly the same
Another thing to check is the use of trailing slashes in app_url. While my case related to the PHP Quickstart, it's possible this affects the others as well.
My Quickstart application was installed to a subdirectory, at https://example.com/docusign/public/. So the redirect URI was set in the DocuSign dashboard as https://example.com/docusign/public/index.php?page=ds_callback - which is correct but I was still getting the "not registered properly" error.
It turns out that the app_url in /docusign/ds_config.php must not have a trailing slash, so
'app_url' => 'https://example.com/docusign/public', // The url of the application.
works but
'app_url' => 'https://example.com/docusign/public/', // The url of the application.
fails with this error.
You just need to add http://localhost:8080/login like the redirect URI in Docusign and you won't see the error message "The redirect URI is not registered properly with DocuSign" again. It's working for me.
you also need to add a redirect URI for each scenario as in: https://localhost:8080/ds/callback,
https://localhost:8080/ds/callback#/username,
https://localhost:8080/ds/callback#/password
Make sure the protocols are also the same
In ds_config.php there is a comment under app_url saying
// Ie, the user enters app_url in their browser to bring up the app's home page
// Eg http://localhost/code-examples-php/public (no trailing slash) if the app is installed in a
// development directory that is accessible via web server.
// NOTE => You must add a Redirect URI of app_url/index.php?page=ds_callback to your Integration Key.
So try adding this to your Integration Key -> Redirect URI, In my case I'm using port 8080.
http://localhost:8080/public/index.php?page=ds_callback
This works for me.

How to redirect with post request from server side?

I am using express in one of my application. I want to make a post request to a url but it should also redirect to that url. Like when we submit a form using GET/POST method it redirect us to that url (). The only solution which is coming in my mind is
make a hidden form
redirect to that form from controller with data
Submit form using js on page load.
The only disadvantage of this solution is user will see a black page for some time till the form gets loaded.
Can anyone suggest some better solution ?
I think what you are looking for is not a "redirect." It's a solution which will send an extra request to another(or the same) URL and get the result from there instead of showing a blank page to the client for redirecting.
If that's correct, please refer to this similar question:How to forward a request to other endpoint in node.js
If you're looking for redirection (HTTP 301 & 302), the easiest way to do it is passing your data through GET URL query string. You can encrypt your data to prevent security risks.

Azure AD Logout Url - Redirect not working

I'm using Azure AD to authenticate users into a ColdFusion web application. All works great, except when I log the user out I want to redirect them back to a page in my application. The logout works correctly as far as clearing the cookies, etc, but the redirect is not happening.
I'm using the following format on my URL for logging out
https://login.microsoftonline.com/<tenant id>/oauth2/logout?&client_id=MY_CLIENT_ID&post_logout_redirect_uri=https://myredirecturl
If I do not supply a valid URI, it gives me a error message stating that 'post_logout_redirect_uri' value must be a valid absolute Uri.. So I know it's seeing the URL parameter properly, but it is just NOT redirecting.
Anyone have any suggestions?
Thank you!
A few things to try:
Try using a different browser. That could indicate a browser-specific JavaScript issue.
Try URL encoding the URL that you're redirecting to.
Make sure the URL you are redirecting to is in the same domain as your web app.
Also, I noticed your logout URL is a little funny: you have both a "?" followed by a "&" before your client_id query string parameter. I suggest you remove the "&" and have your URL look like .../oauth2/logout?client_id=...&post_logout_redirect_uri=...

NEST API redirect does not work

I am developing using ios obj-c. I am trying to get the access token using google GTMOAuth2 library. I could do the "work with nest" login but the redirect doesn't seem to work.I see nest animation and it keeps spinning. I have set the redirect to "h..p://localhost" on the Nest Developer Client settings.
How do i get the redirect correctly?
Or
How can i get the redirect to my App itself
We've added sample code for iOS over here. To see how we got the access token from the redirect url have a look at NestWebViewAuthController. Let us know if you have any further questions!
Cheers,
Raymond
It sounds like the WebView is timing out trying to load localhost since you like don't have a web server running. On iOS the best practice would be to insert a listener into the WebView that is called when your redirect URL is loaded. See Get notified about a page change in UIWebView

Resources