Skip to content

How to create a correct user authentication flow #1

@slavab89

Description

@slavab89

So after creating a working example for this i now need to start working with it :)
The question is what is the correct flow.

My architecture is going to be something like the following:
https://dglozic.files.wordpress.com/2014/10/micro-authentication.png
Meaning that i'll have a web application that's running on some nodeJS server, and i'll have this project on a different server that should take care of user authentications (and later on services)

So how will it work? Say i'm going into my site for the first time. Obviously i dont have an access token (as a user). So i click on the login button. Now there are 2 options:

  1. i immediately show a username and password page.
    Once i enter that info, a grant_type=password request will be send with a client_id and client_secret of the nodejs server that the web application runs on
  2. I send a response_type=code request, and because i dont have any additional authorization header i will not be redirected to the redirect_url, instead i'll be redirected to a login page that's hosted on... (the web application server??)
    It will ask me to enter a username and password triggering grant_type=password request that will get me the access_token and send the response_type=code request again (?!) and continue with grant_type=authorization_code to get the access token that i already have?!

Option 2 seems to be impossible and incorrect but then i dont see when i will need to use the response_type=code request.

I might be totally off in my thinking and i will really be glad if someone could straighten things up for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions