Auth0.js: Docs are missing callback and `relay_url`

Created on 20 Dec 2017  Â·  15Comments  Â·  Source: auth0/auth0.js

  • Looks like auth.popup.authorize() assumes that the second arg is a callback, but the docs don't mention it:

https://auth0.com/docs/libraries/auth0js/v8#webauth-popup-authorize-

  • Docs also don't mention a relay_url:
  auth.popup.authorize(
    {
      connection: 'github',
      responseType: 'token'
    },
    (err, authResult) => {
      console.log({ err, authResult })
    }
  )

{original: "missing required 'relay_url' parameter", code: null, description: null}

This doesn't fix it:

  auth.popup.authorize(
    {
      connection: 'github',
      responseType: 'token',
      relay_url: 'http://localhost:3000/'

v8.12.1

Most helpful comment

@luisrudge, thanks for the info on the OWP param. Is that a valid long term solution to this issue? I'm migrating from v6 to v9 as we speak. The redirect error when using a popup was unintuitive, as we want the pop-up to close, not redirect.

We also noticed that there are missing docs for:

  • Existence and purpose of owp option
  • Existence and signature of callback parameter
  • The fact that the function returns an object with focus and close methods

All 15 comments

Thanks! I added the callback in the docs. The relay_url is used only in very specific cases, so it shouldn't be an issue.
https://github.com/auth0/docs/pull/5465

@luisrudge thanks—what is relay_url and how do I provide it? Adding it as an attribute in the first argument had no effect on the error message

relay_url is just a simple html page that relays the postMessage to auth0.js. Every tenant has its own page already, for example: https://brucke.auth0.com/relay.html
This is already set by default and should only be changed in super specific cases (if you host auth0 by yourself etc).

Are you getting any errors regarding to this?

Yeah, when I try the above code, I get this err:

original: "missing required 'relay_url' parameter", code: null, description: null

Can you build a repro with this?
I just ran the example file in this repo and it works as expected: https://github.com/auth0/auth0.js/blob/master/example/index.html#L328

I'm using popup. When I run the example an click Github button under Login with /authorize (popup), I get this:

image

When I use my own data:

https://github.com/lorensr/auth0.js/commit/1d7305f66dbf078b590977842a3672f9ccae888b

I get this:

image

hmm.. maybe it's github specific? can you try with twitter?

Same result w/ Twitter. Probably has to do with the configuration of my
graphql.auth0.com, but it gives me no indication of what.

On Wed, Dec 20, 2017 at 7:49 PM, Luís Rudge notifications@github.com
wrote:

hmm.. maybe it's github specific? can you try with twitter?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/auth0/auth0.js/issues/596#issuecomment-353225517, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAPVmFgvRoqpDAaDGw_Hv7tgklfEBjo1ks5tCar_gaJpZM4RH_kB
.

Right.. can you try passing owp: true to the authorize call and see if that works?

That works, thank you very much! After adding localhost to allowed origins. Don't see owp in the docs:

https://auth0.com/docs/libraries/auth0js/v8#webauth-popup-authorize-

And now in the callback, authResult is of the form: {accessToken: "foo", expiresIn: 7200, tokenType: "Bearer", state: "bar"}

expiresIn is different from my JWT expiration setting:

image

Is there somewhere I can configure access token expiration?

I'm not sure your value is valid tbh.. I think you're better off asking in our support channels: https://support.auth0.com

I'll ping the docs team to add the owp param.

@luisrudge, thanks for the info on the OWP param. Is that a valid long term solution to this issue? I'm migrating from v6 to v9 as we speak. The redirect error when using a popup was unintuitive, as we want the pop-up to close, not redirect.

We also noticed that there are missing docs for:

  • Existence and purpose of owp option
  • Existence and signature of callback parameter
  • The fact that the function returns an object with focus and close methods

Sorry, the docs were merged to v8 but not to v9. I opened another PR here: https://github.com/auth0/docs/pull/5932

About the owp option, I asked to the backend team if this will be supported in the future, I'll let you know when they answer me. Although, ideally, you should always use the redirectUri + a popup callback page for that:

webAuth.popup.authorize({
  redirectUri: 'https://myapp.com/callback_popup.html'
}, function(err, authResult) {
 //do something
});

And then your callback page would look like this: https://github.com/auth0/auth0.js/blob/master/example/callback_popup.html

Hi ! FYI these informations (about the owp param) still missing today at https://auth0.com/docs/libraries/auth0js/v9 !

documentation on owp is still missing today at https://auth0.com/docs/libraries/auth0js/v9

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterblazejewicz picture peterblazejewicz  Â·  3Comments

NathHorrigan picture NathHorrigan  Â·  6Comments

kmaida picture kmaida  Â·  7Comments

duongmanhhoang picture duongmanhhoang  Â·  3Comments

sh4ka picture sh4ka  Â·  7Comments