authentication - Google Cloud Endpoints without Google Accounts -
our web application not offer google accounts authentication. have implemented our own authentication using webapp2 authentication: http://webapp-improved.appspot.com/tutorials/auth.html.
we'd use cloud endpoints api mobile apps/third party developers still use oauth2 authentication.
what steps required implement this? need setup our own oauth server on appengine , google client libraries compatible?
you don't have anything. have federated log-in app on app-engine added android app uses cloud endpoints. don't have special, put user parameter function. in user object find user email have authorize in order access data.
@api(name = "my_api", version = "v1", scopes = {"https://www.googleapis.com/auth/userinfo.email"}, clientids = {constants.auth_client, constants.auth_client_apiexplorer}) public class myendpoint { @apimethod(name = "fistendpoint") public responseobject fistendpoint(user user) throws oauthrequestexception { if (user == null) { throw new oauthrequestexception("access denied!"); } string email = user.getemail(); //authorize request here //make responseobject , return } }
after created endpoint visit: https://your-app.appspot.com/_ah/api/explorer , test it
updated: the example above restricted google accounts. if want different type account can check out post: custom authentication google cloud endpoints (instead of oauth2)
Comments
Post a Comment