question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

state not being sent

See original GitHub issue
<your detailed question and code samples go here> For some reason my state parameters are not being places into the final url on generateAuthUrl().

My client id, secrets, access type, scopes, and redirect_uri are all generated correctly,

using this code:

let url = this.client.generateAuthUrl({
            // 'online' (default) or 'offline' (gets refresh_token)
            access_type: 'offline',
            // If you only need one scope you can pass it as a string
            scope: SCOPES,
            // Optional property that passes state parameters to redirect URI
            state: {foo: "bar", email: emailAddress, "test": "one"}
        });

I get

https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fmail.google.com%2F&state=&response_type=code&client_id=xxx.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A9000%2Foauth2callback%2Fgoogle

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
alfonmgacommented, Apr 1, 2017

Stringifying and enconding state object did the trick as @matkoklaic mentioned.

This should be included in the documentation.

9reactions
matkoklaiccommented, Mar 22, 2017

Just make sure to stringify and encode state object passed to generateAuthUrl function: state: encodeURIComponent(JSON.stringify(state)).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sending state with react router not working - Stack Overflow
I have checked the state in the react dev tools, and tested with Jest, but both show that state is not being forwarded...
Read more >
Why React doesn't update state immediately - LogRocket Blog
State updates in React are asynchronous; when an update is requested, there is no guarantee that the updates will be made immediately.
Read more >
US Constitution - SOS.ri.gov
Rhode Island was the only state not to send delegates to the Constitutional Convention in 1787. Then, when asked to convene a state...
Read more >
Frequently Asked Questions - California Secretary of State
The Secretary of State does not issue licenses or permits for business ... Similar letters are being sent to California limited liability companies....
Read more >
Election Security Rumor vs. Reality - CISA
Rumor: Voting system software is not reviewed or tested and can be easily manipulated. Get the Facts: State and local election officials ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found