api auth via expo

so i am using api plugin and trying to auth with expo but i get an error browser error
{ error: "Failed to fetch the token." }
{ error: "Failed to fetch the token." }
bot log error

2025-01-22 19:27:12 - ERROR - {
2025-01-22 19:27:12 - ERROR - error: 'invalid_request',
2025-01-22 19:27:12 - ERROR - error_description: 'Missing "code_verifier"'
2025-01-22 19:27:12 - ERROR - }

2025-01-22 19:27:12 - ERROR - {
2025-01-22 19:27:12 - ERROR - error: 'invalid_request',
2025-01-22 19:27:12 - ERROR - error_description: 'Missing "code_verifier"'
2025-01-22 19:27:12 - ERROR - }
i followed the docs for the back end part so have
api: {
auth: {
id: envParseString('CLIENT_ID'),
secret: envParseString('CLIENT_SECRET'),
cookie: envParseString('AUTH_COOKIE_NAME'),
redirect: envParseString('REDIRECT_URI'),
scopes: [OAuth2Scopes.Identify, OAuth2Scopes.Guilds],
transformers: [],
domainOverwrite: isDev() ? '127.0.0.1' : undefined,
},
prefix: 'api',
listenOptions: {
port: envParseNumber('PORT', 3000),
},
},
api: {
auth: {
id: envParseString('CLIENT_ID'),
secret: envParseString('CLIENT_SECRET'),
cookie: envParseString('AUTH_COOKIE_NAME'),
redirect: envParseString('REDIRECT_URI'),
scopes: [OAuth2Scopes.Identify, OAuth2Scopes.Guilds],
transformers: [],
domainOverwrite: isDev() ? '127.0.0.1' : undefined,
},
prefix: 'api',
listenOptions: {
port: envParseNumber('PORT', 3000),
},
},
4 Replies
Monkie
MonkieOP2d ago
my expo code very simple
Monkie
MonkieOP2d ago
im trying to understand what the issue could be i get the code back as i can log it but seems to fail when exchangeCodeForToken is called
Favna
Favna23h ago
gosh idt there is anyone with substantial react native knowledge here but I would say if possible try first eliminating the expo factor and just doing it without. Heck I dont even know if RN supports the built in auth which is based on same-site http-only strict cookies, which therefore require that you have an SSL certificate when running it outside localhost.
Monkie
MonkieOP21h ago
i believe i have it working but i will do more checks/ debuggin and post my fix The main thing is deep linking to my app I need to use PKCE but api does not support it as I have ti turn this to false on expo end to get it to work on web but still have and issue with it in native ie i need the redirect link to open my app, but for me to set the redirect link on discord to myapp:// I need PKCE

Did you find this page helpful?