forum

[resolved] osu!API redirect_url with params

posted
Total Posts
2
Topic Starter
ilia21
Hello! I am making a website for osu!, and it involves logging in with an osu! account. I already made oAuth work, but it always redirects to the home page because that is the url I provided in "application callback urls". I want for users to be redirected back to the page they were on after logging in. I thought I could just pass a page in the query, then append it to the osu.ppy.sh/oauth link and handle it from there. But redirect url should be exactly as in "application callback urls". so for example localhost:3000/callback works because it's a callback urls, but localhost:3000/callback?origin=matches not because it's different.
My question is: is there a way to pass url params in redirect url? I tried putting http://localhost:3000/* in application callback urls, but it didn't work.

If needed, here's my current setup:
login button redirects to myapi.url/login
myapi.url/login redirects to osu.ppy.sh/oauth, with ?redirect_uri=http://myapi.url/callback
myapi.url/callback does it's magic of getting the token, creating the user session, appending the token to it, and redirecting back to the site.

What I want:
Login button to redirect to myapi.url/login?origin=${current page}
myapi.url/login redirects to oauth, with ?redirect_uri=http://myapi.url/callbackorigin=${current page}
myapi.url/callback does it's magic of getting the token, creating the user session, appending the token to it, and redirecting the user to the page they were on, ${current page}.
Topic Starter
ilia21
Solved!
If anyone finds this in the future, here's how I solved it:
I made the login button open a popup window with the login page, which after login redirects the user to the page that says "Login successful, you can close this window".
This way it won't redirect user back to the homepage after login
Please sign in to reply.

New reply