Hello,
I’m using Ember-CLI, and Ember-Simple-Auth with the Torii wrapper. I have everything working correctly so I can login via google oauth2, however I cannot for the life of me figure out how to get the users info from google.
I’ve tried writing a torii adapter like so with no luck as it doesn’t seem to be called
// app/torii-adapters/application.js
export default Ember.Object.extend({
open: function(authorization){
console.log('authorization from adapter', authorization);
}
});
Thoughts or suggestions?
update stack overflow question as per @marcoow’s request
Thank you
I wasn’t able to get the torii adapter working, however by extending the torii google oauth2 provider I can then call google’s apis and get some token/user info. From this stack overflow question I see that we need to switch to the ‘token’ response params, however when switching my torii provider to this it hangs on the login popup.
So I think the solution is to extend the torii oauth/google-oauth to properly support the response from the token workflow
I have figured it out.
Torii doesn’t provide this information by default. Also the default google-oauth2 uses the code workflow where the G+ API needs the token workflow
To fix this I created a custom provider that extended oauth2-bearer provider and borrowed from the google-oauth2 provider. I then make a request to the G+ API in the provider for user info.
I have created a full tutorial here that outlines start to finish an authorized ember app with cli, ember-simple-auth and torii. If you clone the repo there is a fully working example that just needs your apiKey(client_id)
3 Likes