File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ ( function ( hello ) {
2+
3+ hello . init ( {
4+ line : {
5+ name : "line" ,
6+ oauth : {
7+ version : 2 ,
8+ auth : "https://access.line.me/oauth2/v2.1/authorize" ,
9+ grant : "https://api.line.me/oauth2/v2.1/token" ,
10+ response_type : "code" ,
11+ client_secret : process . env . LINE_CLIENT_SECRET ,
12+ scope : {
13+ basic : "profile%20openid%20email" , // https://developers.line.biz/en/docs/line-login/integrate-line-login/#scopes
14+ } ,
15+ state : Math . random ( ) ,
16+ scope_map : {
17+ basic : [ "profile" , "openid" , "email" ] ,
18+ } ,
19+ } ,
20+
21+ base : "https://access.line.me/oauth2/v2.1/" ,
22+
23+ // WRAPPER
24+ get : {
25+ me : function ( p , callback ) {
26+ p . path = "https://api.line.me/v2/profile" ;
27+ p . headers = {
28+ Authorization : `Bearer ${ p . authResponse . access_token } ` ,
29+ } ;
30+ callback ( "https://api.line.me/v2/profile" ) ;
31+ } ,
32+ } ,
33+
34+ login : function ( p ) {
35+ // OAuth2 non-standard adjustments
36+ p . qs . scope = "profile%20openid%20email" ;
37+ } ,
38+
39+ wrap : {
40+ me : function ( o ) {
41+ if ( o . userId ) {
42+ o . picture = o . thumbnail = o . pictureUrl ;
43+ o . id = o . userId ;
44+ o . name = o . displayName ;
45+ }
46+
47+ return o ;
48+ } ,
49+ } ,
50+
51+ jsonp : false ,
52+ } ,
53+ } ) ;
54+ } ) ( hello ) ;
You can’t perform that action at this time.
0 commit comments