OAuth2 Authorization Endpoint Usage Guide
Overview
This guide describes how to use the OAuth2 authorization endpoint for third-party applications. The process includes obtaining client_id and secret_id, user authentication, and authorization.
Step 1: Client_id and secret_id creation
To start the authorization process, you need to obtain a client_id and secret_id from the following endpoint:
https://publicapi.nationsglory.fr/oauth/create
Request Method
PUT
Request Parameters
name (string): The name of your service (Defaults to "My Service").
redirect_uri (string): The URI to which users will be redirected after login.
Example Response
{ "client_id": "your_client_id", "secret_id": "your_secret_id" }
Step 2: Create Authorization Link
Once you have the client_id and redirect_uri, create a link to redirect users to the authorization process.
https://publicapi.nationsglory.fr/oauth/auth
Required Parameters
client_id (string): Your application's client ID.
redirect_uri (string): The URI to which the user will be redirected after authorization.
Example Link
<a href="https://publicapi.nationsglory.fr/oauth/auth?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI">Connect with NationsGlory</a>
Step 3: User Authentication
If the user is not already authenticated, they will be prompted to log in. The login form requires the following fields:
email: User's email address.
password: User's password
Step 4: Authorization
Once authenticated (and 2FA verified if applicable), the user will be asked to authorize access to their data. They can either authorize or cancel the request.
Example Authorization Request
If the user authorizes the request, they will be redirected to the redirect_uri with an access_token query parameter.
Example:
YOUR_REDIRECT_URI?access_token=ACCESS_TOKEN
Step 5: Validate access_token
To validate the access_token, make an HTTP GET request to the oauth/checkToken endpoint with the following query parameters:
https://publicapi.nationsglory.fr/oauth/checkToken
Request Parameters
access_token (string): The access token obtained after authorization.
client_secret (string): The client secret obtained during the client ID creation.