Skip to content

Commit

Permalink
Merge pull request #55 from openfort-xyz/of-619-link-thirdpartyauth-w…
Browse files Browse the repository at this point in the history
…ith-oauth

feat: link third party
  • Loading branch information
gllm-dev authored Oct 31, 2024
2 parents 1c2d84b + 8380c83 commit 8bbfa7c
Show file tree
Hide file tree
Showing 15 changed files with 372 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.12] - 2024-10-31
### Added
- Link Third Party Auth Provider

## [0.8.11] - 2024-10-23
### Added
- Support for new chains
Expand Down
103 changes: 101 additions & 2 deletions packages/internal/openapi-clients/src/backend-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@
"discord",
"epic_games",
"facebook",
"telegram",
"accelbyte",
"firebase",
"lootlocker",
"playfab",
"supabase",
"custom",
"oidc"
"oidc",
"telegramMiniApp"
],
"type": "string"
},
Expand Down Expand Up @@ -1801,6 +1803,22 @@
"type": "object",
"additionalProperties": false
},
"GrantCallbackRequest": {
"properties": {
"code": {
"type": "string"
},
"state": {
"type": "string"
}
},
"required": [
"code",
"state"
],
"type": "object",
"additionalProperties": false
},
"OAuthResponse": {
"properties": {
"url": {
Expand All @@ -1821,6 +1839,10 @@
"properties": {
"options": {
"properties": {
"callbackTo": {
"type": "string",
"description": "A URL to custom handle the provider callback"
},
"queryParams": {
"properties": {},
"additionalProperties": {
Expand Down Expand Up @@ -1851,20 +1873,42 @@
"type": "object",
"additionalProperties": false
},
"ThirdPartyLinkRequest": {
"properties": {
"provider": {
"$ref": "#/components/schemas/ThirdPartyOAuthProvider"
},
"token": {
"type": "string"
},
"tokenType": {
"type": "string"
}
},
"required": [
"provider",
"token",
"tokenType"
],
"type": "object",
"additionalProperties": false
},
"OAuthProvders": {
"enum": [
"google",
"twitter",
"facebook",
"discord",
"epic_games",
"telegram",
"accelbyte",
"firebase",
"lootlocker",
"playfab",
"supabase",
"custom",
"oidc"
"oidc",
"telegramMiniApp"
],
"type": "string"
},
Expand Down Expand Up @@ -9227,6 +9271,9 @@
"security": [
{
"pk_access_token": []
},
{
"pk_third_party": []
}
],
"parameters": [
Expand All @@ -9251,6 +9298,58 @@
}
}
},
"/iam/v1/oauth/link": {
"post": {
"operationId": "LinkThirdParty",
"responses": {
"201": {
"description": "Success response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthPlayerResponse"
}
}
}
},
"401": {
"description": "Api key is not valid"
}
},
"summary": "Initialize Link OAuth.",
"tags": [
"Authentication"
],
"security": [
{
"pk_access_token": []
},
{
"pk_third_party": []
}
],
"parameters": [
{
"in": "header",
"name": "x-game",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ThirdPartyLinkRequest"
}
}
}
}
}
},
"/iam/v1/oauth/pool": {
"post": {
"operationId": "PoolOAuth",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ models/gas-report-transaction-intents-list-response.ts
models/gas-report-transaction-intents.ts
models/gas-report.ts
models/google-oauth-config.ts
models/grant-callback-request.ts
models/grant-oauth-response.ts
models/index.ts
models/init-embedded-request.ts
Expand Down Expand Up @@ -315,6 +316,7 @@ models/supabase-auth-config.ts
models/telegram-oauth-config.ts
models/telegram-third-party-config.ts
models/test-trigger200-response.ts
models/third-party-link-request.ts
models/third-party-oauth-provider-accelbyte.ts
models/third-party-oauth-provider-custom.ts
models/third-party-oauth-provider-firebase.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ import { SIWERequest } from '../models';
// @ts-ignore
import { SignupRequest } from '../models';
// @ts-ignore
import { ThirdPartyLinkRequest } from '../models';
// @ts-ignore
import { ThirdPartyOAuthRequest } from '../models';
// @ts-ignore
import { UnlinkEmailRequest } from '../models';
Expand Down Expand Up @@ -448,6 +450,47 @@ export const AuthenticationApiAxiosParamCreator = function (configuration?: Conf
options: localVarRequestOptions,
};
},
/**
*
* @summary Initialize Link OAuth.
* @param {ThirdPartyLinkRequest} thirdPartyLinkRequest
* @param {string} [xGame]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
linkThirdParty: async (thirdPartyLinkRequest: ThirdPartyLinkRequest, xGame?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'thirdPartyLinkRequest' is not null or undefined
assertParamExists('linkThirdParty', 'thirdPartyLinkRequest', thirdPartyLinkRequest)
const localVarPath = `/iam/v1/oauth/link`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (xGame != null) {
localVarHeaderParameter['x-game'] = String(xGame);
}



localVarHeaderParameter['Content-Type'] = 'application/json';

setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(thirdPartyLinkRequest, localVarRequestOptions, configuration)

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Authenticate a player based on email and password.
* @summary Email and password login.
Expand Down Expand Up @@ -1241,6 +1284,18 @@ export const AuthenticationApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.linkSIWE(sIWEAuthenticateRequest, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Initialize Link OAuth.
* @param {ThirdPartyLinkRequest} thirdPartyLinkRequest
* @param {string} [xGame]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async linkThirdParty(thirdPartyLinkRequest: ThirdPartyLinkRequest, xGame?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AuthPlayerResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.linkThirdParty(thirdPartyLinkRequest, xGame, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* Authenticate a player based on email and password.
* @summary Email and password login.
Expand Down Expand Up @@ -1532,6 +1587,16 @@ export const AuthenticationApiFactory = function (configuration?: Configuration,
linkSIWE(requestParameters: AuthenticationApiLinkSIWERequest, options?: AxiosRequestConfig): AxiosPromise<AuthPlayerResponse> {
return localVarFp.linkSIWE(requestParameters.sIWEAuthenticateRequest, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Initialize Link OAuth.
* @param {AuthenticationApiLinkThirdPartyRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
linkThirdParty(requestParameters: AuthenticationApiLinkThirdPartyRequest, options?: AxiosRequestConfig): AxiosPromise<AuthPlayerResponse> {
return localVarFp.linkThirdParty(requestParameters.thirdPartyLinkRequest, requestParameters.xGame, options).then((request) => request(axios, basePath));
},
/**
* Authenticate a player based on email and password.
* @summary Email and password login.
Expand Down Expand Up @@ -1864,6 +1929,27 @@ export interface AuthenticationApiLinkSIWERequest {
readonly sIWEAuthenticateRequest: SIWEAuthenticateRequest
}

/**
* Request parameters for linkThirdParty operation in AuthenticationApi.
* @export
* @interface AuthenticationApiLinkThirdPartyRequest
*/
export interface AuthenticationApiLinkThirdPartyRequest {
/**
*
* @type {ThirdPartyLinkRequest}
* @memberof AuthenticationApiLinkThirdParty
*/
readonly thirdPartyLinkRequest: ThirdPartyLinkRequest

/**
*
* @type {string}
* @memberof AuthenticationApiLinkThirdParty
*/
readonly xGame?: string
}

/**
* Request parameters for loginEmailPassword operation in AuthenticationApi.
* @export
Expand Down Expand Up @@ -2239,6 +2325,18 @@ export class AuthenticationApi extends BaseAPI {
return AuthenticationApiFp(this.configuration).linkSIWE(requestParameters.sIWEAuthenticateRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
*
* @summary Initialize Link OAuth.
* @param {AuthenticationApiLinkThirdPartyRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthenticationApi
*/
public linkThirdParty(requestParameters: AuthenticationApiLinkThirdPartyRequest, options?: AxiosRequestConfig) {
return AuthenticationApiFp(this.configuration).linkThirdParty(requestParameters.thirdPartyLinkRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
}

/**
* Authenticate a player based on email and password.
* @summary Email and password login.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ export const AuthProviderResponse = {
Discord: 'discord',
EpicGames: 'epic_games',
Facebook: 'facebook',
Telegram: 'telegram',
Accelbyte: 'accelbyte',
Firebase: 'firebase',
Lootlocker: 'lootlocker',
Playfab: 'playfab',
Supabase: 'supabase',
Custom: 'custom',
Oidc: 'oidc'
Oidc: 'oidc',
TelegramMiniApp: 'telegramMiniApp'
} as const;

export type AuthProviderResponse = typeof AuthProviderResponse[keyof typeof AuthProviderResponse];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* tslint:disable */
/* eslint-disable */
/**
* Openfort API
* Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/



/**
*
* @export
* @interface GrantCallbackRequest
*/
export interface GrantCallbackRequest {
/**
*
* @type {string}
* @memberof GrantCallbackRequest
*/
'code': string;
/**
*
* @type {string}
* @memberof GrantCallbackRequest
*/
'state': string;
}

Loading

0 comments on commit 8bbfa7c

Please sign in to comment.