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

Grant does not work when cookies are blocked #216

Closed
ArvindhMangoleap opened this issue Jan 7, 2021 · 5 comments
Closed

Grant does not work when cookies are blocked #216

ArvindhMangoleap opened this issue Jan 7, 2021 · 5 comments

Comments

@ArvindhMangoleap
Copy link

This is my config object.

const config = {
    defaults: { origin: ORGIN, state: true, prefix: "/api/account/:accountId",  },
    google: { key: GOOGLE_CLIENT_ID, secret: GOOGLE_CLIENT_SECRET, scope: ["openid"], nonce: true },
};

I am getting dynamic accountId and I need to send that in state rather than having a random state.

@simov
Copy link
Owner

simov commented Jan 7, 2021

No that's not possible. But why not send the account ID as state in this case:

/connect/:provider?state=accountId

Another way is hide the Grant connect endpoint behind yours.

@ArvindhMangoleap
Copy link
Author

Thank you for the quick reply.

@ArvindhMangoleap
Copy link
Author

I am getting this error

error=Grant%3A%20missing%20session%20or%20misconfigured%20provider#

{
    defaults: { origin: ORGIN },
    google: {
        key: GOOGLE_CLIENT_ID,
        secret: GOOGLE_CLIENT_SECRET,
        scope: ["openid", "https://mail.google.com/"],
        nonce: true,
        dynamic: ["state"],
        custom_params: { access_type: "offline", prompt: "consent" },
    },
}

Am I missing something in my config?

@ArvindhMangoleap
Copy link
Author

Update:
The problem seems to appear only when I block the cookies. It works fine when I allow cookies.

Is there a way to solve this without using cookies or session storage.

@ArvindhMangoleap ArvindhMangoleap changed the title Is there a way to pass dynamic state coming from url to grant Oauth Grant does not work when cookies are blocked Jan 8, 2021
@simov
Copy link
Owner

simov commented Jan 8, 2021

No, cookies are required in order to execute the OAuth flow. After you receive the access token you are free to destroy the session if you want.

You can read about different cookie configuration options here #199

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

No branches or pull requests

2 participants