Rails7+devise+omniauthでCORS policyで怒られた時
問題
<%= button_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path %>
こうしたら、こうなりました。
Access to fetch at 'xxx' (redirected from 'http://localhost:3000/users/auth/google_oauth2') from origin 'http://localhost:3000' has been blocked by CORS policy
解決法
に習い、data: { turbo: false }
をつけてTurboを無効にしましょう。
<%= button_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path, data: { turbo: false } %>
Author And Source
この問題について(Rails7+devise+omniauthでCORS policyで怒られた時), 我々は、より多くの情報をここで見つけました https://qiita.com/sijiaoh/items/d2e34790e011b951d6cf著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .