Authentication

You must issue App Secret before issuing jwt token to use channel APIs.

Follow below sequences from App config - Authentication & Authorization in Channel Development Portal.


1. Issuing App Secret


Click Issue button located on the top of the App Settings page. Be careful not to expose issued secret. Previously issued secret will be invalidated if you refresh it.



2. Registering App Permissions


You must select the Functions you want to use on each sections: Channel, User, Manager. See here for details on each function.

Permissions you selected on User and Manager sections will be included in tokens passed to WAM.

Permissions you selected on Channel section can be issued with token by following process (3).



3. Exchanging App Secret with Token through Native Function


Once you have issued App secret, you can exchange it with jwt token using Native Function.

Token requests including issueToken and refreshToken has rate-limit: 10 tokens per 30 minutes with fixed-window.

Be aware that your token request can be rejected due to rate-limit mechanisms even if you used valid secret and channelId.


IssueToken

methodPUT
endpointapp-store-api.channel.io/general/v1/native/functions
notesExchange jwt token with App Secret
  • Request

    {
    	"method": "issueToken",
    	"params": {
    		"secret": ""
    		"channelId": ""
    	}
    }
    
    fieldsnotesrequiredtype
    secretApp Secrettruestring
    channelIdchannelId if you want to specify chanenlfalsestring

    If you do not specify channelId , app token will be issued by default. It includes permissions of following Native Functions.

    • registerCommands - registers commands to app. For detailed explanations, please refer Command documentations.

      If you specify channelId, you can issue token including permissions you selected on Channel section on step (2). In this case, make sure your app is installed on specified channel.

  • Response

    {
    	"accessToken": "{access-token}",
    	"refreshToken": "{refresh-token}",
    	"expiresIn": 1800,
    }
    
    fieldsnotesrequiredtype
    refreshTokenrefreshTokentruestring
    accessTokenaccessTokenfalsestring
    expiresInsecondstrueint64

    Your token is located on accessToken . See below for usage of refreshToken.


refreshToken

methodPUT
endpointapp-store-api.channel.io/general/v1/native/functions
notesrefresh token
  • Request

    {
    	"method": "refreshToken",
    	"params": {
    		"refreshToken": "{refresh-token}"
    	}
    }
    
    paramsnotes
    refreshTokenrefreshToken you got on above step
  • Response

    {
    	"accessToken": "{access-token}",
    	"refreshToken": "{refresh-token}",
    	"expiresIn": 1800,
    }
    


4. Using jwt Token


You can use jwt tokens on x-access-token http header when using Native Functions or Functions.


Example using x-access-token on Function calling)

PUT app-store-api.channel.io/general/v1/native/fucntions
x-access-token: "{token}"
...

{
	"method": "writeUserChatMessage"
	"params": { ... }
}