I'm using gems devise_token_auth' and graphql_devise` for my authentication and I'm able to generate the token. Here is an example one that I just generated along with client and expiry:
#<struct DeviseTokenAuth::TokenFactory::Token
client="TeoomlVVA0xMCNKff4Q3Fw",
token="DOXnJR8iPlwHgXHUYJXi6w",
token_hash="$2a$10$PdliAqqiGXyp1ARfTQzYEeQMKxSF7X1peXgyDLRBz44cKXlI1zh1W",
Then when I'm trying to authenticate with it, it can't decode the token raising ArgumentError: invalid base64 from inside of the devise_token_auth gem from set_user_by_token method that calls decode_bearer_token. The method receives my token and on this line returns {}: JSON.parse(Base64.strict_decode64(encoded_token)) rescue {}. The token is present but when I run just Base64.strict_decode64(encoded_token) from from <internal:pack>:29:in `unpack1', it raises an error ArgumentError: invalid base64.
I'm using Rails version: 7.0.4.3 Ruby version: ruby 3.2.2
The token itself is generated during login in the same gem in user.rb in create_token in this line: token = DeviseTokenAuth::TokenFactory.create(client: client, lifespan: lifespan, cost: cost) with all args being nil. The token is returned and later this output returned to the front end via the rest of pipeline of devise_token_auth and graphql_devise:
tokens[token.client] = {
token: token.token_hash,
expiry: token.expiry
}.merge!(token_extras)
Even at this time, the token can't be decoded if I try to call Base64.strict_decode64(encoded_token) on it.