Authorization ingame (in manialink) - example?

Maniaplanet public API, ManiaConnect system and the open source PHP SDK.

Moderator: NADEO

Post Reply
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Authorization ingame (in manialink) - example?

Post by BigBang1112 »

As a relatively new user to OAuth2, I'm getting confused by a lot of the things. I need a beginner level help.

I need to authorize the user ingame to make real safe requests and sends to a PHP page. Most of my tries just give page errors though.
I already made an application in Web Services settings, I have the two IDs and a redirect page, but I don't know what to do with them.

https://doc.maniaplanet.com/web-services/oauth2
This link tells the general needed stuff, but from it I still don't know how to use it. The parameter info is too brief. :?

The OAuth2 links seem to work in manialink browser, although I still keep getting parameter errors. Do I need to install the webservices PHP application when I only need things from basic scope and token? Are the OAuth2 links enough to be able to authorize the user?

Example of ingame auth is hugely appreciated.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
Miss
Posts: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Authorization ingame (in manialink) - example?

Post by Miss »

Are you providing all the params to the authorization URI?

response_type=code&client_id=...&scope=...&state=...&redirect_uri=...
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: Authorization ingame (in manialink) - example?

Post by BigBang1112 »

Ye I dont and I know that is the reason. I just don't know like what state exactly means and things ("a non predictable random string" - is this like a short time password?).
Sometimes a brief documentation doesn't help understanding and that's why I need a simple example of OAuthing that fully works.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
Miss
Posts: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Authorization ingame (in manialink) - example?

Post by Miss »

It's a random string that you generate, which will be returned later by the oauth service in the redirect URL. You can then confirm that the request originated from the right session. (ie. don't allow authorization if state in redirect URI is not the same as what you generated in the first step.)
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: Authorization ingame (in manialink) - example?

Post by BigBang1112 »

Oh I'm actually starting to see it shaping. I managed to authorize my own app and now I got the huge code and state, which can be used for access_token... whow. Thanks for clearing my OAuth spaces. I somehow didn't manage to see that.

I might post an example myself when I opened this topic anyway :D

Edit: What if I wanna redirect user to manialink? What is the proper redirect uri?
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
BigBang1112
Posts: 389
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: Authorization ingame (in manialink) - example?

Post by BigBang1112 »

Issue detected:
When I set the redirect_uri to a normal http:// URL, the authorization works just fine in normal browser but ingame the link fails.

Looking a bit more to the manialink code ingame, I found that the

Code: Select all

&redirect_uri=http://www.
is being changed to

Code: Select all

&redirect_uri=http:/www.
Is there a solution for this or is it just a long staying bug? Can be manialink code used as a redirect?

Edit: Using dem %2F instead of slashes fixed it rather quickly, whops
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 1 guest