Desktop Application Authorization Flow

Desktop application flow is a slightly modified version of the client-side flow. Since desktop applications do not normally run their own web servers, we cannot redirect back to the desktop app URL. Instead, we will redirect to an internal url with the returned fields. Desktop applications can listen to the browser URL changes. Once a URL is matched against a special Platform URL, desktop application can get the access token and other parameters from the URL.

Autentimine & Autoriseerimine

To enter the authentication/authorization desktop client flow, you must point an embedded browser to the authorization url and pass the following parameters:

Oauth URL

https://www.geni.com/platform/oauth/authorize

Parameetrid

Nimi Kirjeldus Kohustuslik
client_id Application key generated during the app registration. true
response_type For the client side flow the response type must be set to "token". true
display For a desktop application embedded browser, set the display value to "desktop". true
scope Komadega eraldatud nimekiri õigustest, mida rakendus vajab. Vaikimisi lubab "scope" täieliku ligipääsu. This is subject to change in the upcoming releases. false

Näide

https://www.geni.com/platform/oauth/authorize?client_id=YOUR_APP_KEY&response_type=token&display=desktop

Kui kasutaja on juba sisse logitud, valideerime sisselogimisküpsise, mille oleme kasutaja brauserisse salvestanud ja autentime kasutaja.If the user is not logged in, they are prompted to enter their credentials:

Once we have successfully authenticated the user, we will prompt the user to authorise your application:

If the user presses Don't Allow, your app is not authorised. Kasutaja suunatakse (läbi HTTP 302) kindlalale URL aadresssile, mis sisaldab alljärgneva veateate:

Vastuseväljad

Nimi Tüüp Kirjeldus
status String If user cancels the authorisation flow, the status will be set to "unauthorised".
message String Veateade

Näide

https://www.geni.com/platform/oauth/auth_failed#status=unauthorized&message=user+canceled

If the user presses Allow, your app is authorised. The user will be redirected (via HTTP 302) to the special URL with an authorization code:

Vastuseväljad

Nimi Tüüp Kirjeldus
access_token String Access token to be used with every API request
expires_in Number Seconds until the token will expire

Näide

https://www.geni.com/platform/oauth/auth_success#access_token=ACCESS_TOKEN_GENERATED_BY_SERVER &expires_in=SECONDS_UNTIL_IT_IS_EXPIRED
rails-1a-001