vendredi 27 mai 2016

How can I use OpenID with my own RESTful API?

I'm currently creating an EmberJS application,

So obviously my front end is done in EmberJS, and I've decided to go with Go (Golang) as my API service.

I've gotten the back end authentication working using Steams OpenID service

The problem I'm currently facing is, my API runs on localhost:3000 and my front end runs on localhost:4200.

So how can I make a request to my API service which will require human intervention part way through (to be able to type in the username / password on steams website before redirecting back) from my client side.

Right now

localhost:3000/auth/login is to initiate the OpenID request which redirects to steams website

and then

localhost:3000/auth/return is the callback on returning from steams website

I need to be able to some how use this authentication from the client side via some how to be able to authenticate users, e.g.:

$.get("localhost:3000/auth/login").then(() => { 
    // How the hell am I supposed to login on steams website from here
});

any information would be great as this is really stumping me. If you'd like to see any code feel free to ask, I'm not sure what to provide as everything is working as intended, but I just can't figure out how to connect the API to the client and make OpenID work the way I need to. Thanks!

Side Note: I know some websites will have a popup which the authentication in there (like a twitter or facebook popup) and then refresh the main site after the authentication has been processed I don't know how I might achieve something like that.




Aucun commentaire:

Enregistrer un commentaire