-
Notifications
You must be signed in to change notification settings - Fork 252
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 get access_token? #203
Comments
If you want token for google then, in config along with URL, clientId, etc. pass responseType: "token" |
Thank you @SahilVasava , that helped. I think the documentation needs to be worked on |
Hi Paulo, took some time for me, but found it out. So in my setup I have a web app running on port 8080 at localhost, my backend is running at 8081. Respectively, I configured my github provider: baseUrl:'http:localhost:8081' In my Backend, I created a post endpoint at /github/auth that takes the response from github after you called it in your frontend as given here: this.$auth.authenticate('github') This call will trigger github to post to your backend (do not forget the cors settings on your backend that github is allowed to call your api) with the following information: {"code":"a code","clientId":"your client id","redirectUri":"http://localhost:8080"} I then extracted the code and did a new post request from the backend to "https://github.com/login/oauth/access_token" as described here. This request has the following form: {client_id='your client id', client_secret='your client secret', code='a code'} I then get an access_token back: {access_token='access token', expires_in=28800, refresh_token='refresh token', refresh_token_expires_in=15638400, scope='', token_type='bearer'} Now, I queried the github user api at https://api.github.com/user with the access token in the Authorization header: "Authorization: token access_token". Finally, I have my user information :) Hope that helps, Eric |
Hello I need to get access_token in place of the "code".
Any ideas how I can get it?
The text was updated successfully, but these errors were encountered: