# TCGBAuthAdapterDelegate Protocol Reference

Conforms to | NSObject
Declared in | TCGBAuthAdapterDelegate.h

## Overview

The protocol TCGBAuthAdapterDelegate is for developing Auth Adapter.
This protocol contains several methods such as to login, logout and so on.

## Other Methods

### `– initWithAdditionalInfo:` required method

## @name Authentication API

`- (instancetype)initWithAdditionalInfo:(TCGBAuthAdapterAdditionalInfo *)additionalInfo`

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– loginWithSender:target:additionalInfo:viewController:completion:` required method

Login to identity service provider.

`- (void)loginWithSender:(NSObject *)sender target:(id<TCGBAuthAdapterDelegate>)target additionalInfo:(nullable NSDictionary<NSString*,id> *)additionalInfo viewController:(UIViewController *)viewController completion:(void ( ^ ) ( TCGBProviderAuthCredential *_Nullable credential , TCGBError *_Nullable error ))completion`

#### Parameters

`sender` | sender instance
`target` | target instance
`additionalInfo` | If identity provider needs to set something when it is initialized, this additionanlInfo is set.
`viewController` | presenting view controller
`completion` | completion handler when auth process(login, logout, withdraw) is completed.

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– logoutWithSender:target:additionalInfo:completion:` required method

Logout to identity service provider.

`- (void)logoutWithSender:(NSObject *)sender target:(id<TCGBAuthAdapterDelegate>)target additionalInfo:(nullable NSDictionary<NSString*,id> *)additionalInfo completion:(void ( ^ ) ( TCGBError *_Nullable error ))completion`

#### Parameters

`sender` | sender instance
`target` | target instance
`additionalInfo` | If identity provider needs to set something when it is initialized, this additionanlInfo is set.
`completion` | completion handler when auth process(login, logout, withdraw) is completed.

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– withdrawWithSender:target:additionalInfo:completion:` required method

Withdrwal to identity service provider.

`- (void)withdrawWithSender:(NSObject *)sender target:(id<TCGBAuthAdapterDelegate>)target additionalInfo:(nullable NSDictionary<NSString*,id> *)additionalInfo completion:(void ( ^ ) ( TCGBError *_Nullable error ))completion`

#### Parameters

`sender` | sender instance
`target` | target instance
`additionalInfo` | If identity provider needs to set something when it is initialized, this additionanlInfo is set.
`completion` | completion handler when auth process(login, logout, withdraw) is completed.

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– addMappingWithSender:target:additionalInfo:viewController:completion:`

Mapping to identity service provider.

`- (void)addMappingWithSender:(id)sender target:(id<TCGBAuthAdapterDelegate>)target additionalInfo:(nullable NSDictionary<NSString*,id> *)additionalInfo viewController:(nullable UIViewController *)viewController completion:(void ( ^ ) ( id _Nullable credential , TCGBError *_Nullable error ))completion`

#### Parameters

`sender` | sender instance
`target` | target instance
`additionalInfo` | If identity provider needs to set something when it is initialized, this additionanlInfo is set.
`completion` | completion handler when auth process(login, logout, withdraw) is completed.

#### Declared In

`TCGBAuthAdapterDelegate.h`

## Provider information

### `– authInfosFromProvider`

Provider’s authenticated credential

`- (nullable TCGBProviderAuthCredential *)authInfosFromProvider`

#### Return Value

Provider’s authenticated credential

#### Declared In

`TCGBAuthAdapterDelegate.h`

## Adapter information

### `+ versionString` required method

semantic version string of Auth Adapter

`+ (NSString *)versionString`

#### Return Value

semantic version string of Auth Adapter

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– providerName` required method

Provider’s name

`- (NSString *)providerName`

#### Return Value

Provider’s name

#### Declared In

`TCGBAuthAdapterDelegate.h`

## Application life cycle for identify provider's sdk setting

### `– application:willFinishLaunchingWithOptions:`

Managing State Transitions

`- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions`

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– application:didReceiveRemoteNotification:fetchCompletionHandler:`

Responding to Notifications and Events

`- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult result ))completionHandler`

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– application:openURL:options:`

handle OpenURL

`- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options`

#### Declared In

`TCGBAuthAdapterDelegate.h`

### `– scene:openURLContexts:`

handle OpenURL

`- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext*> *)URLContexts`

#### Declared In

`TCGBAuthAdapterDelegate.h`