Skip to content
New issue

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

Session access token encoding error for Facebook callback #68

Open
jstorm31 opened this issue Sep 11, 2020 · 1 comment
Open

Session access token encoding error for Facebook callback #68

jstorm31 opened this issue Sep 11, 2020 · 1 comment

Comments

@jstorm31
Copy link

I'm using Facebook provider for authentication in my Vapor 4 app. Everything works fine on localhost, but I get the following error for callback URL for the app deployed on Heroku: invalidValue("long_fb_code_here", Swift.EncodingError.Context(codingPath: [], debugDescription: "Top-level String encoded as string JSON fragment.", underlyingError: nil)). I've found out this happens when setting a session access token in FacebookRouter.swift:52. For some reason the encoder has troubles with encoding the received access token as a string in Sessions+Imperial.swift:62.

As I noted it works fine on localhost which is really strange and I have no clue why. 😅 I have everything set up fine on Facebook side. As a temporary workaround I forked this repo and replaced try session.setAccessToken(accessToken) with session.data["access_token"] = accessToken. That works fine. I really wonder why this is an issue only in the deployed app.

If it is relevant, I use fluent as storage for sessions.

@0xTim
Copy link
Member

0xTim commented Sep 24, 2020

Hmm that's weird. I wonder if it's a Fluent issue 🤔

The only way that line could fail would be if it's trying to set invalid data to JSON. Is this still reproducible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants