Skip to content

Commit

Permalink
Switch to OAuth 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nlehuby committed Apr 18, 2024
1 parent 68ea5d4 commit af31ca7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
8 changes: 8 additions & 0 deletions assets/osm-auth_2.4.0/osm-auth.iife.min.js.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 21 additions & 14 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var editorName = 'Sidewalker'
var editorName = 'Luke Sidewalker'
var version = '0.0.1'

var useTestServer = false;
Expand All @@ -7,24 +7,31 @@ var urlOverpass = 'https://overpass-api.de/api/interpreter?data=';
var urlJosm = 'http://127.0.0.1:8111/import?url=';
var urlID = 'https://www.openstreetmap.org/edit?editor=id';

var urlOsmTest = useTestServer
var urlOsm = useTestServer
? 'https://master.apis.dev.openstreetmap.org'
: 'https://www.openstreetmap.org';

var redirectPath = window.location.origin + window.location.pathname;
console.log(redirectPath)
var auth = useTestServer
? osmAuth({
url: urlOsmTest,
oauth_consumer_key: '',
oauth_secret: '',
auto: true,
//singlepage: true
? osmAuth.osmAuth({
url: urlOsm,
client_id: "luke_sidewalker",
redirect_uri: redirectPath + "land.html",
scope: "read_prefs write_api",
singlepage: false
})
: osmAuth({
url: urlOsmTest,
oauth_consumer_key: 'a9CFoAHkYhEZY5G42NjdqsHKXazAZoJ1jtVn0fBV',
oauth_secret: 'sTeC2rplH0RZtyQVl6t2Qtoy8bOU4EFbv8p8rP5x',
: osmAuth.osmAuth({
url: urlOsm,
client_id: "A5-wd3saMmeWsH__bVeSTP1Qv4AmMz5_BheZ7-7Fk8g",
redirect_uri: redirectPath + "land.html",
auto: true,
//singlepage: true
scope: "read_prefs write_api",
singlepage: false
});

if (window.location.search.slice(1).split('&').some(function(p) { return p.indexOf('code=') === 0; })) {
auth.authenticate(function() {
history.pushState({}, null, window.location.pathname);
checkOSMAuth();
});
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script src="https://cdn.rawgit.com/mlevans/leaflet-hash/master/leaflet-hash.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/L.Control.Locate.min.js"></script>
<script src="https://cdn.rawgit.com/tyrasd/jxon/master/jxon.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/osm-auth@1.1.2/osmauth.js"></script>
<script src="assets/osm-auth_2.4.0/osm-auth.iife.min.js.js"></script>
<script src="assets/leaflet-sidebar_v2-0.4.0/leaflet-sidebar.min.js"></script>


Expand Down

0 comments on commit af31ca7

Please sign in to comment.