Auth0Client for M2M?

Hey there, is it possible to use Auth0Client for M2M communication? I can happily implement the POST example here to get an access token to call my API with but I’m planning on using this flow for applications external to my organization. I’d prefer to ask them to copy/paste a one-liner that instantiates Auth0Client to retrieve an access token rather than having them construct their own POST request.

When I try to instantiate Auth0Client with the app’s credentials I get

{"error":"access_denied","error_description":"Client is not authorized to access \\"https://...". You need to create a \\"client-grant\\" associated to this API. See: https://auth0.com/docs/api/v2#!/Client_Grants/post_client_grants"} (Auth0::AccessDenied)

Hey there @tjones welcome to the community!

I assume you’re referring to Auth0Client of of auth0-spa-js? This is a client-side SDK not intended to handle client credentials of any kind (see public vs confidential applications). A client credentials exchange should take place server-side and you can go about writing that code however you like.

More info here:

Sorry, I should have been more specific. I was referring to the ruby-auth0 client. I’m assuming the response still applies?

1 Like

Gotcha, thanks for clarifying and sorry just getting back to you on this!

Management API SDK libraries includingruby-auth0 are designed to be used against the Auth0 Management API as opposed to your own - It doesn’t sound like that’s suitable for your use case.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.