ember-simple-auth icon indicating copy to clipboard operation
ember-simple-auth copied to clipboard

Please provide an example of authentication using Devise with Omniauth

Open ccoffey opened this issue 5 years ago • 0 comments

I have a simple Rails app and have configured Devise with Omniauth exactly as described in this tutorial.

I am now trying to replace an ERB UI with Ember. However, I am unsure how to configure ember-simple-auth.

In ERB I simply have the following:

<%= link_to “Sign in with Facebook”, user_facebook_omniauth_authorize_path %>

In Ember I have tried creating the following authenticator:

// app/authenticators/devise.js

import DeviseAuthenticator from "ember-simple-auth/authenticators/devise";

export default DeviseAuthenticator.extend({
  serverTokenEndpoint: "http://localhost:3000/users/auth/facebook"
});

However when I click my login button I see the following error in the Chrome dev console:

Access to XMLHttpRequest at 'https://www.facebook.com/oauth/authorize?approval_prompt=auto&client_id=abc&redirect_uri=def(redirected from 'http://localhost:3000/users/auth/facebook') from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I'm really unsure how to proceed. Could someone please point me in the right direction?

ccoffey avatar Jan 25 '20 15:01 ccoffey