Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get "id_token" in lineSDKObjC ? #185

Closed
shuaku110dai opened this issue Jun 5, 2023 · 6 comments
Closed

how to get "id_token" in lineSDKObjC ? #185

shuaku110dai opened this issue Jun 5, 2023 · 6 comments

Comments

@shuaku110dai
Copy link

shuaku110dai commented Jun 5, 2023

how to get "id_token" in lineSDKObjC?

请问一下,哥,如何在lineSDKObjC的SDK里面获取LineSDKAccessToken的json字符串中id_token字段(当权限允许openID),我看LineSDKAccessToken的结构里面没有哇,谢谢大哥。

@onevcat
Copy link
Member

onevcat commented Jun 6, 2023

I believe there is an IDToken property, by which you can access the fields in the ID Token (which in turn is a JWT under the hood):

LineSDKAccessToken *token = store.currentToken;
LineSDKJWT *idToken = token.IDToken;
NSLog(@"User Name: %@", idToken.payload.name);

@shuaku110dai
Copy link
Author

shuaku110dai commented Jun 6, 2023

1 你好,哥,通过你说的代码,就是下面

 LineSDKAccessToken *token = store.currentToken; 
 LineSDKJWT *idToken = token.IDToken;
 NSLog(@"User Name: %@", idToken.payload.name);

这个结构暴露的好像是IDToken解析出来的一系列属性。

2 但是我这边的需求是想要的是IDToken的原始字符串,需求如下图所示:
image

3 我这边看您5.9.0最新的源码里面大概可能是下图这样一个属性里面的值:

image
image
或者
image

4 总结:我该如何获取第2点截图里面的那个id_token字段呐,期待哥的回复

@onevcat
Copy link
Member

onevcat commented Jun 6, 2023

It is not yet marked as public! I will add that and release a new version soon.

@shuaku110dai
Copy link
Author

明白了,谢谢哥,我等哥更新,然后我这边在更新版本,哥yyds!!!。

@onevcat
Copy link
Member

onevcat commented Jun 8, 2023

Version 5.9.1 was released and the related property is now added. Please try to upgrade to it to get that raw string.

Thanks for reporting it and the kind feedback.

@onevcat onevcat closed this as completed Jun 8, 2023
@shuaku110dai
Copy link
Author

大哥,牛b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants