2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OmniAuthで開発環境でもmockで認証する方法

Posted at

テストするときと基本同じなんだけど、メモ。
メールアドレスが固定になるので、これを見て、実際に利用する場合はご注意を。

initializers/omniauth.rb
if Rails.env.development?
  OmniAuth.config.test_mode = true
  OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(
    provider: 'google_oauth2',
    uid: SecureRandom.uuid,
    info: {
      email: "admin@example.com"
    }
  )
end
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?