Authorization ingame (in manialink) - example?

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

Moderator: NADEO

Post Reply
User avatar
BigBang1112
Posts: 239
Joined: 20 Jul 2015, 12:44
Location: Český Krumlov, Czech Republic
Contact:

Authorization ingame (in manialink) - example?

Post by BigBang1112 » 18 Jun 2018, 08:46

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.
Image

User avatar
Miss
Posts: 1144
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Authorization ingame (in manialink) - example?

Post by Miss » 18 Jun 2018, 09:34

Are you providing all the params to the authorization URI?

response_type=code&client_id=...&scope=...&state=...&redirect_uri=...
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative Maniaplanet scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

User avatar
BigBang1112
Posts: 239
Joined: 20 Jul 2015, 12:44
Location: Český Krumlov, Czech Republic
Contact:

Re: Authorization ingame (in manialink) - example?

Post by BigBang1112 » 18 Jun 2018, 15:42

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.
Image

User avatar
Miss
Posts: 1144
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Authorization ingame (in manialink) - example?

Post by Miss » 18 Jun 2018, 16:28

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.)
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative Maniaplanet scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

User avatar
BigBang1112
Posts: 239
Joined: 20 Jul 2015, 12:44
Location: Český Krumlov, Czech Republic
Contact:

Re: Authorization ingame (in manialink) - example?

Post by BigBang1112 » 18 Jun 2018, 17:55

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?
Image

User avatar
BigBang1112
Posts: 239
Joined: 20 Jul 2015, 12:44
Location: Český Krumlov, Czech Republic
Contact:

Re: Authorization ingame (in manialink) - example?

Post by BigBang1112 » 05 Jul 2018, 00:29

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
Image

Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 3 guests