/get_jwt.sql Secret
Last active
February 23, 2023 03:57
LINEのチャネルアクセストークンを取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
C_RSA_KEY constant varchar2(32767) := q'~ | |
-----BEGIN RSA PRIVATE KEY----- | |
MIIEpAIBAAKCAQEAv/U8xG3mIfYn2gGI39e4f5yG3w0aTCrOercbkVq+pR4fWVCe | |
アサーション署名キーの元となった秘密鍵のデータ | |
ZFsGzmTKr43RtEAX24VWsbZqve0sERVAyEwRZ6EYpryUpbNfJ2RHJg== | |
-----END RSA PRIVATE KEY-----~'; | |
l_jwt varchar2(32767); | |
l_token varchar2(32767); | |
l_expires_in number; | |
l_key_id varchar2(32767); | |
begin | |
/* JWTの生成 */ | |
l_jwt := util_line_api.generate_jwt( | |
p_secret => C_RSA_KEY | |
,p_kid => 'アサーション署名キーのID' | |
,p_channel_id => 'Messaging APIのチャネルID' | |
,p_token_exp => 3600 | |
); | |
/* トークンの取得 */ | |
l_token := util_line_api.get_token( | |
p_jwt => l_jwt | |
,p_credential_static_id => 'LINE_CHANNEL_ACCESS_TOKEN' | |
,p_expires_in => l_expires_in | |
,p_key_id => l_key_id | |
); | |
dbms_output.put_line(l_key_id); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment