AkuminaAuthiOSLib 0.1.84

AkuminaAuthiOSLib 0.1.84

Akumina 维护。



  • Akumina

AkuminaAuthiOSLib

示例

要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install

要求

安装

AkuminaLib 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 中

pod 'AkuminaAuthiOSLib'

作者

Akumina

使用示例

import AkuminaAuthiOSLib

使用 MSAL 登录 MSAL

 do {
        let clientDetails : ClientDetails =  try ClientDetails(authority: , clientId: , redirectUri: , scopes: , sharePointScope: , appManagerURL: , tenantId: )
            
        try AkuminaLib.instance.authenticateWithMSALAndMAM(parentViewController: self, clientDetails: clientDetails, completionHandler: { result in
            if (result.error != nil) {
                // Handle MSAL or MAM Error 
            }else {
                // Check for the token in result. 
                    
            }
        }, loggingHandler: { message, error in
            if(error) {
                // Handle Error messge
            }else {
                // Handle Info message 
            }
        })
    }catch{
        // Handle exception here
    }

仅使用 MSAL 登录

   do {
        let clientDetails : ClientDetails =  try ClientDetails(authority: , clientId: , redirectUri: , scopes: , sharePointScope: , appManagerURL: , tenantId: )
            
        try AkuminaLib.instance.authenticateWithMSAL(parentViewController: self, clientDetails: clientDetails, completionHandler: { result in
            if (result.error != nil) {
                // Handle MSAL or MAM Error 
            }else {
                // Check for the token in result. 
                    
            }
        }, loggingHandler: { message, error in
            if(error) {
                // Handle Error messge
            }else {
                // Handle Info message 
            }
        })
    }catch{
        // Handle exception here
    }

登录后获取令牌

    do {
        try let token = AkuminaLib.instance.getToken(type: TokenType);
        // TokenType are 
            TokenType.ACCESS --  To get Akumina Token 
            TokenType.GRAPH --  To get Graph token 
            TokenType.SHAREPOINT -- To get sharepoint token 
    }catch{
        // Handle exception here. 
    }

调用 Akumina REST API

不使用有效负载调用 REST API

      do {
            Akumina.instance.callAkuminaAPI(endPoint: String, method: String,accessToken: String?, query:
                           Dictionary<String,String>, payLoad: Data? , completionHandler: @escaping (_ success: Bool, _ data: Data? , _ error: Error?) -> Void )
      }catch{
            // Handle exception 
      }

使用有效负载调用 REST API

 do {
            Akumina.instance.callAkuminaAPI(endPoint: String, method: String,accessToken: String?, query:
                           Dictionary<String,String>, payLoad: Data? , completionHandler: @escaping (_ success: Bool, _ data: Data? , _ error: Error?) -> Void)
      }catch{
            // Handle exception 
      }

许可证

AkuminaAuthiOSLib 可在 MIT 许可下获得。有关更多信息,请参阅 LICENSE 文件。