thefirstofthe300 291 Posted March 16, 2015 Share Posted March 16, 2015 I am attempting to get a plugin working (Luke probably knows which one ) and I am wondering how to get OAuth working. This is my first time even attempting to work with OAuth so I am very unfamiliar with the workflow. However, based on my understanding of what I have read, the workflow goes something like this: I post to the OAuth URL with the client_id and a pop up with the sign in page for the service pops up. The user grants permission for the app to access the user's account. The app receives an authorization code and redirects to the value of the redirect URI. The app requests an auth token from the OAuth server using the client_id, client_secret, and authorization code. If authorization is successful, the app receives an auth token and a refresh token which it then uses to communicate with the server. When the auth token expires, the app uses the refresh token to get a valid auth token. Due to the nature of OAuth, I really haven't found a way to simply login with a username and password that doesn't revoke the ability to use a refresh token so that is out of the question (due to the nature of what I am trying to do). If I am incorrect in any of the above points, please correct me. My question is this: will the OAuth popup work with the plugin configuration? I imagine it would but I don't want to get into this, have it not work, and be chasing my tail attempting to figure out why if the problem is with the server itself. Link to comment Share on other sites More sharing options...
hamstercat 63 Posted March 16, 2015 Share Posted March 16, 2015 Yeah it does work, OAuth2 is not the simplest thing to understand but once you get the hang of it it's fine. You can look at my Google Drive one if you need inspiration, I'm using OAuth there as well in the config page. Link to comment Share on other sites More sharing options...
thefirstofthe300 291 Posted March 16, 2015 Author Share Posted March 16, 2015 Thanks hamstercat. That was all I needed to know. Any idea when your Drive plugin is getting published? I personally use Drive and would like to see how it works (auth and all). Link to comment Share on other sites More sharing options...
Luke 37133 Posted March 16, 2015 Share Posted March 16, 2015 i gave him a change to make, once that's done i think it's going to be about ready to go 1 Link to comment Share on other sites More sharing options...
Luke 37133 Posted March 16, 2015 Share Posted March 16, 2015 the current plugin code is here https://github.com/MediaBrowser/MediaBrowser.Plugins/tree/master/MediaBrowser.Plugins.GoogleDrive it's the config page i've asked him to change to be more like foldersync, but the oauth side of it is good for reference Link to comment Share on other sites More sharing options...
thefirstofthe300 291 Posted March 17, 2015 Author Share Posted March 17, 2015 Quick question, what is your redirect url configured to be? Link to comment Share on other sites More sharing options...
hamstercat 63 Posted March 17, 2015 Share Posted March 17, 2015 (edited) It must be the config page, so I'm using javascript to find the current URL before doing the redirect. Then, you can use the code you receive and make appropriate calls to find the access token and refresh token and save them in the config. Edited March 17, 2015 by hamstercat Link to comment Share on other sites More sharing options...
thefirstofthe300 291 Posted March 18, 2015 Author Share Posted March 18, 2015 Regarding the change to the config page, is there a standard format that you want to use for it? Link to comment Share on other sites More sharing options...
hamstercat 63 Posted March 18, 2015 Share Posted March 18, 2015 Using the folder sync plugin as inspiration, the Google Drive now looks like this (not yet comitted): There is a place at the top for plugin-wide config, and then the user can add connections to Google Drive with a name and the users who are allowed to use it. 1 Link to comment Share on other sites More sharing options...
Untoten 296 Posted March 31, 2017 Share Posted March 31, 2017 Using the folder sync plugin as inspiration, the Google Drive now looks like this (not yet comitted): There is a place at the top for plugin-wide config, and then the user can add connections to Google Drive with a name and the users who are allowed to use it. Did you ever make further progress on this? I am beginning to lose faith that LDAP or SSO will ever be added so I am trying anything. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now