-
Notifications
You must be signed in to change notification settings - Fork 156
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 setup Authorization Code Flow #115
Comments
@NickAb The Authorization Code Flow is also sometimes called server side flow, which means you need your backend server to do some work. In your case, your server needs to understand and process the redirect (think about |
@faraway thank you.
But how would this token get returned back to client? More specifically how backend will now the redirect uri for the client (Angular SPA)? |
I assume client means browser here. I mention this because in the OAuth2 spec, client actually refers to the app server while the browser is called user agent In authorization code flow, the access token is never returned back to the browser. Instead, the token is kept (safely) at the app server side, which is one of the major reasons that auth code flow exists. In implicit flow(which oauth-ng is mostly used for) that has token maintained at browser side, the access_toke usually expires very soon (usually 30 ~ 60 mins), because browser can not keep the token safe. Whereas in auto code flow, the token can be kept in app server side for longer time, usually you can also request for refresh token as well. If you use auth code flow, this is the way I would assume that things should work:
So for the auth-code flow, there's not really much things to do at browser side (SPA). You probably don't even need a javascript library because we just need to init the auth request. On the other hand, there's some significant work needed at the app sever side. That's why most IdP will have their SDK for app server side provided. (e.g. google's sdk https://developers.google.com/api-client-library/java/google-api-java-client/oauth2 for their oauth2 ) |
@faraway Thank you for clarification. |
Anyone could share simple code using Authorization Code Flow for requesting token using code. I have been trying for 2 day, but not successful now i hopeless, :-D. please give me some clue. thanks. |
I need to implement Authorization Code Flow to authorize against ADFS server.
I have downloaded demo https://github.com/andreareginato/oauth-ng-demo and installed latest oauth-ng.
I am getting redirect to adfs loging page where I login, after that a redirect back to redirect-uri="http://localhost:9000" happens and ulr changes to
So I got authorization code but no other action to exchange
code
for access token did happen. What should I do, should I add code for requestingtoken
usingcode
, or should it be handled automatically by oauth-ng and I have some configuration problem?The text was updated successfully, but these errors were encountered: