Angular.js
OAuth2 로그인 scope 여러개 지정하기 복수
개발자자자
2020. 7. 31. 16:43
아래에 보면 access token을 받아오기 위해 꼭 지정해야하는 네가지가 있다.
response_type, client_id, redirect_uri, scope
여기서scope란 인증받은 사용자에게 구글에서 제공해주는 사용자의 정보 범위인데
나는 profile,email둘다를 가져와보고 싶었다.
배열등을 사용해봐도 안되었는데
해결책은 단지,
uri두개를 같은 작은따옴표 ' ' 에 띄어쓰기로 구분해서 한번에 적어주면 되던것이었다. 요렇게
'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email ',
화이팅
this.queryStr = stringify({
response_type: 'token',
client_id: CLIENT_ID,
redirect_uri: window.location.href,
scope:
'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email ',
});
this.loginUrl = AUTHORIZE_URI + '?' + this.queryStr;