简体   繁体   中英

Trying to figure out how to use oAuth2 without a server using PHP CLI

What I want do is be able to use oAuth2 from a CLI app that I wrote. The app works, but right now I have to goto this website right now and pull my token off the returned URL https://beta.geoloqi.com/oauth/authorize?response_type=code&client_id= $clientid&redirect_uri=http://geoloqi.com

The oAuth2 specification sys I can use localhost as the redirect_uri, but I've not been able to figure out to get it to work. I am not running a web server, and would rather not have to open any ports on my router to make this work. (I can open a port if I need to)

I am using PHP v5.3.3 on currently on a linux (Ubuntu) box, but I need to also run the script from Windows as well.

the idea is for it to be automated, and not have me put the token in everytime.

IS there any way to do this from the CLI or will I need to run a server?

Thanks for the help LeRoy

You would probably want to use the Authentication from a Device flow instead of the web flow. The Authentication from a Device flow requires you to pass in the username and password in exchange for the access token. You would need to talk to the OAuth provider (Geoloqi in your case) on how to set up your account to use this flow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM