The Frontier Auth service is a OAuth2 provider for third-party developers to use in applications that require access to Frontier APIs.
The Auth Service uses the standard OAuth2 specification (https://oauth.net/2/). It currently only allows Authorization Token authentication.
The access token returned by from the Auth Service has a short expiry time and a refresh token which can be used when the access token has expired. Note: The refresh token will be updated each time a new access token is requested. The refresh token may also expire, in which case you will need to direct users to re-authorize using the Frontier Auth Service.
We also support PKCE (Pronounced Pixie). Which allows logins from client side applications. See Execute an Authorization Code Grant Flow with PKCE for details.
What is Personally Identifiable Information for Frontier Games?
Who is responsible for accepting Frontier Terms & Conditions?
Why do we start needing to consider Personally Identifiable Information?
The PHP example below is an example of using the Frontier Auth Service with the popular League OAuth2 package: (https://github.com/thephpleague/oauth2-client)
Notes:
PKCE Notes:
You may add an audience query string parameter to the /auth route, i.e. ?audience=xbox or a combination using comma seperated strings ?audience=xbox,steam,frontier
available audiences (lower case please):
You should also pass a scope to the auth service /auth endpoint when first requesting access, query parameter is scope, scopes are space seperated as per OAuth2 spec, and are additive.
Available scopes:
<?php
declare(strict_types=1);
/*
* MIT Licence
*
* Copyright 2018 Frontier Developments plc
*
* Permission is hereby granted, free of charge, to
* any person obtaining a copy of this software and
* associated documentation files (the "Software"),
* to deal in the Software without restriction,
* including without limitation the rights to
* use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is
* furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission
* notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace App\Factory;
use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Provider\GenericProvider;
/**
* Creates a League OAuth2 GenericProvider with the correct
* credentials for using the Frontier Auth service.
*/
class AuthProviderFactory
{
private const CLIENT_ID = 'foo';
private const CLIENT_SECRET = 'bar';
private const AUTH_API = 'https://auth.frontierstore.net';
private const CALLBACK_URL = 'https://myclient.example/auth';
/**
* @return GenericProvider
*/
public function create(): AbstractProvider
{
return new GenericProvider([
'scope' => 'auth capi',
'clientId' => self::CLIENT_ID,
'clientSecret' => self::CLIENT_SECRET,
'redirectUri' => self::CALLBACK_URL,
'urlAuthorize' => self::AUTH_API . '/auth',
'urlAccessToken' => self::AUTH_API . '/token',
'urlResourceOwnerDetails' => self::AUTH_API . '/decode', // You may also use /me if you don't need the full JWT expiry, etc.
]);
}
}
Example user information from /me route using auth or capi scope(JSON formatted):
PC login
{
"customer_id":"12345789",
"firstname":"Dave",
"lastname":"Lister",
"email":"dave@reddwarf.ship",
"platform":"frontier",
"thirdPartyUserId": null,
"parent_id": null
}
PSN login (auth or capi scope, JSON format):
{
"customer_id":"987654321",
"firstname":"PSNUser",
"lastname":"",
"email":"1234567890@frontier-playstation.co.uk",
"parent_id":"12345789",
"thirdPartyUserId":"1234567890",
"platform":"psn"
}
Example /decode route return information
"iat" and "exp" claims are UTC timestamps. "iss" will always be "https://auth.frontierstore.net"
{
"iss":"https://auth.frontierstore.net"
"usr": {
"customer_id": "123456890"
"firstname": "Dave"
"lastname": "Lister"
"email": "dave@example.com"
"platform": "frontier"
},
"iat": 1547463135
"exp": 1547477535
"scope": "auth capi"
}