We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
souls_fb_auth
I updated souls-doc's firebase login method like below;
module Mutations module Managers::UserManager class SignInUser < BaseMutation field :status, String, null: false field :token, String, null: true field :user_role, String, null: true field :username, String, null: true argument :token, String, required: false def resolve(token:) payload = souls_fb_auth(token: token) begin user = ::User.find_by_uid(payload["sub"]) user.update(icon_url: payload["picture"], username: payload["name"]) token_base = JsonWebToken.encode(user_id: user.id) { status: "ログイン成功!", username: user.username, token: token_base } rescue StandardError user = ::User.new( uid: payload["sub"], email: payload["email"], icon_url: payload["picture"], username: payload["name"], user_role: 4 ) if user.save token = JsonWebToken.encode(user_id: user.id) { status: "ユーザー新規登録完了!", username: user.username, token: token, user_role: user.user_role } else { status: user.errors.full_messages } end end end end end end
SOULs Doc
It would be super if that souls_fb_auth works behind and return Firebase payload.
current code
module Mutations class BaseMutation < GraphQL::Schema::RelayClassicMutation argument_class Types::BaseArgument field_class Types::BaseField input_object_class Types::BaseInputObject object_class Types::BaseObject def fb_auth(token:) FirebaseIdToken::Certificates.request! sleep(3) if ENV["RACK_ENV"] == "development" @payload = FirebaseIdToken::Signature.verify(token) raise(ArgumentError, "Invalid or Missing Token") if @payload.blank? @payload end , ,
The text was updated successfully, but these errors were encountered:
Resolved by #146
Sorry, something went wrong.
jamesneve
No branches or pull requests
I updated souls-doc's firebase login method like below;
SOULs Doc
It would be super if that
souls_fb_auth
works behind and return Firebase payload.current code
The text was updated successfully, but these errors were encountered: