How to go about logging a user in to a website through UXP

Question for anyone.

How would you go about logging into a site through your plugin?

My case is that I want to post to an online API but the user has to be logged in for this to work obviously.

I have created the form with a user name and password.

Ideally, what I’d like to do is have the user login through their browser and then come back to the plugin.

1 Like

See the OAuth documentation and samples in the XD documentation.

It’s the same flow.

The sad thing is, without at least a simple https: listener built-in to XD, you’ll need an external server to “bounce off”.

2 Likes

What do you mean https listener?

I found the sample:

and read through the docs:

https://adobexdplatform.com/plugin-docs/tutorials/how-to-integrate-with-OAuth/#1-install-nodejs-packages

For my case I’d like to connect to a Wordpress REST API and it looks like that’s possible but I need to use basic auth or OAuth.

From what I’ve read basic auth is simplest but I would need to request the user type in the login every session. The login details are sent in each call.

For OAuth it’s not simple on developer side? The user opens a link in their browser and logs in. Meanwhile the plugin is polling in the background until it is authorized and then it has a token to make calls. The user needs to login each session via the browser?

1 Like

If we had the ability to set up a web worker, for example, listening on an https: server port localport, then the final OAuth redirect could be to localhost:localport so we could get the final token.

Without that, we have to depend on an external server to be redirected to, and polled by our plugin. No real way around it.

1 Like

Is adding Web Workers difficult? If UXP is using a JavaScript engine it might already support web workers. Would that solve the problem?

Well, just a “small matter of programming.”

Apparently it’s on their long-term timeline but don’t know where.

Is the Trello being updated these days, Adobe folk?