-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support authenticate with facebook access token #793
base: master
Are you sure you want to change the base?
Support authenticate with facebook access token #793
Conversation
Hi, @Charlie-Hua, do you have an example about how to use this with a native app? I'm trying to implement this in a project |
@israelb I don't know how to use with native app, but this PR should work if you put |
@Charlie-Hua - thanks for taking the time to send this PR. Sorry for the delay, I'll take a look ASAP! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR @Charlie-Hua , it is exactly what I need :)
Just a little suggestion to be able to override the response format.
@@ -209,6 +209,10 @@ def render_data_or_redirect(message, data, user_data = {}) | |||
|
|||
# build and redirect to destination url | |||
redirect_to DeviseTokenAuth::Url.generate(auth_origin_url, data.merge(blank: true)) | |||
|
|||
elsif using_access_token_strategy? | |||
render json: { success: true, data: user_data.merge(data).merge({message: message}) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this into a dedicated method, so it will be really easy to customize the response format.
Have a look at https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/controllers/devise_token_auth/registrations_controller.rb#L65 for an example.
@lynndylanhurley were you possible close on this one? |
@zachfeldman I'm working to add support to a client to verify that this works as expected. If anyone else has the time to set up a client with usage instructions I'll be happy to check it out. |
Cool thanks so much @lynndylanhurley !! |
I changed /auth/:provider/callback url to api/v1/auth/:provider/callback and set routes for same in routes but getting auth_hash nil for rest api call |
@nantestdevoloper is your comment related to this pull request? |
Added a new condition in
OmniAuthCallbacks#render_data_or_redirect
to render user data if the OmniAuth strategy name matches 'AccessToken'.It's supposed to work with lynndylanhurley/ng-token-auth#341 and the omniauth-facebook-access-token gem.